I developed a game for android that uses Audio Record to get the mic input.
You can have a glance at https://play.google.com/store/apps/details?id=fixappmedia.micro
The thing is that I'm using the following function to get the sample rates available on the phone:
public int getValidSampleRates() {
int r=8000;
for (int rate : new int[] {8000,11025,16000,22050,44100}) { // add the rates you wish to check against
int bufferSize = AudioRecord.getMinBufferSize(rate, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT);
if (bufferSize > 0) {
r= rate;
}
}
return r;
}
I tested it initially on my phone (Samsung Galaxy Vibrant) and it worked pretty well... but today I tested it on a Samsung Galaxy Ace and the sample rate didn't work...
Any ideas on why?
I'm the developer of voice recording app (Hi-Q MP3 Voice Recorder), and I found out that all phones supports either 44100 Hz, 48000 Hz, or both.
Looking at your code, you missed out 48000.