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
If your encoding is ENCODING_PCM_16BIT
, Then you should use
private int cAmplitude= 0;
while(isRecording) {
read = recorder.read(data, 0, bufferSize);
for (int i=0; i cAmplitude) {
cAmplitude = curSample;
}
}
Log.d("amplitude",Integer.toString(cAmplitude));
cAmplitude = 0;
}
private short getShort(byte argB1, byte argB2) {
return (short)(argB1 | (argB2 << 8));
}
For more info, have a look at How to record voice in "wav" format in Android