我有一个可以读取麦克风的应用程序。具体来说,我检测到对着麦克风吹气 ;) 它不适用于很多 HTC 设备。我买了 HTC Droid Eris 和 HTC Droid Incredible。除此之外,我还收到许多使用 HTC 设备的 friend 的报告,包括相对较新的 HTC Thunderbolt。
因此,调试该应用程序表明,星巴克的环境房间噪音记录在 4000-11000 之间。一旦我对着麦克风吹气,输入音量就会降到 4000 秒:每次,一直。
有人知道这是否可以通过编程方式禁用吗?
这是我读取输入的方式......
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;
}
}
最佳答案
它可以设置到非常小的程度。
使用音频源 MediaRecorder.AudioSource.VOICE_RECOGNITION
而不是 MediaRecorder.AudioSource.MIC
将关闭该输入的音频过滤器。一般来说,就您在设备之间看到的过滤而言,它有点像狂野的西部。即使使用 VOICE_RECOGNITION
也不是完美的,因为关闭过滤器仅在 Ice Cream Sandwich 兼容性定义中采用。 HTC 在 Ice Cream Sandwich 之前使用它,所以对于您的情况,它可能是正确的选择。
来自 Android 4.0 Compatibility Definition Document 的第 5.3 节:
In addition to the above recording specifications, when an application has started recording an audio stream using the
android.media.MediaRecorder.AudioSource.VOICE_RECOGNITION
audio source:
- Noise reduction processing, if present, MUST be disabled.
- Automatic gain control, if present, MUST be disabled.
关于android - 禁用 HTC 噪音消除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10424133/