When ever I run the getMinBufferSize() method in the AudioRecorder Class, the method always returns -2. Even when I change the sample rate, the encoding method, and the channel number. I have tried every combination possible, but it still returns -2. I know that the permissions are there for RecordAudio. If I comment out the line for the getMinBufferSize, and make the minBuffer 4096, the Audio recorder will initialize and record. This will only work when I have the sample rate set to 8000, and the recordings sound like trash. If I change the sample rate at all, the program will force close.
Edit:
bufferSize = AudioRecord.getMinBufferSize(8000,AudioFormat.CHANNEL_CONFIGURATION_DEFAULT,ENCODING_PCM_16BIT);
I am running this on the emulator, a Droid Eris, Droid 1, and Droid 2 Global
Looking at the code for AudioRecord.java, there’s really only 3 possibilities here:
Source: http://google.com/codesearch/p?hl=en#uX1GffpyOZk/media/java/android/media/AudioRecord.java
See also: Why does AudioRecord.getMinBufferSize return ERROR_BAD_VALUE (-2)?