Disable HTC Noise Cancellation

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; } } 
+6
source share
1 answer

It is installed to a very small extent.

Using the sound source MediaRecorder.AudioSource.VOICE_RECOGNITION instead of MediaRecorder.AudioSource.MIC will disable the sound filters for this input. In general, this is a kind of wild west in terms of filtering, which you see from device to device. Even using VOICE_RECOGNITION not perfect, since disabling filters was accepted only in accordance with the definition of compatibility with Ice Cream Sandwich. HTC used it before Ice Cream Sandwich, although for your case this would probably be the right choice.

From section 5.3 of the Android 4.0 doc :

In addition to the above recording specifications, when the application began to record an audio stream using the android.media.MediaRecorder.AudioSource.VOICE_RECOGNITION sound source:

  • Noise processing, if present, MUST be disabled.
  • Automatic gain control, if present, MUST be disabled.
+5
source

Source: https://habr.com/ru/post/914766/


All Articles