I have an app that reads the microphone. Specifically I'm detecting blowing into the microphone ;) It doesn't work on a lot of HTC devices. I've picked up an HTC Droid Eris as well as an HTC Droid Incredible. In addition to those I have reports from many friends that have HTC devices also experiencing this problem to include the relatively new HTC Thunderbolt.
So, debugging the app has shown that ambient room noise registers from 4000-11000 in a Starbucks. As soon as I blow into the mic the input volume drops to the 4000s: every time, all the time.
Anyone know if this can be programmatically disabled?
Here's how I'm reading the input ...
int minBufferSize = AudioRecord.getMinBufferSize(8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT);
AudioRecord audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC, 8000, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, minBufferSize);
short[] buffer = new short[minBufferSize];
audioRecord.startRecording();
audioRecord.read(buffer, 0, minBufferSize);
int i = 0;
for (short sample : buffer) {
inputVolume = Math.abs(sample);
maxVolumeIn = (inputVolume > maxVolumeIn) ? inputVolume : maxVolumeIn;
if (inputVolume >= micSensitivity) {
Log.d(TAG, "Blowing Detected. Volume Level: " + inputVolume);
break;
}
}