I have an application that reads a microphone. In particular, I detect a blow in the microphone;) It does not work on many HTC devices. I took the HTC Droid Eris as well as the HTC Droid Incredible. In addition to those, I have reports from many friends whose HTC devices are also experiencing this problem to include the relatively new HTC Thunderbolt.
So, debugging the application showed that ambient noise is recorded from 4000-11000 in Starbucks. As soon as I get into the microphone, the input volume drops to 4000: every time, all the time.
Does anyone know if this can be software disabled?
This is how I read 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; } }
source share