Implement getMaxAmplitude for audioRecord

前端 未结 3 1192
借酒劲吻你
借酒劲吻你 2021-02-08 03:11

I am using audioRecord instead of mediarecorder in my app it\'s working fine but I have a logic that depends highly on the maxamplitude which is really hard to obtain using the

3条回答
  •  难免孤独
    2021-02-08 03:57

    int amplitude = (buffer[0] & 0xff) << 8 | buffer[1];
    amplitude = Math.abs(ab);
    

    Do you make a mistake here? I think it should be

    int ab = (buffer[0] & 0xff) << 8 | buffer[1];
    int amplitude = Math.abs(ab);
    

提交回复
热议问题