我将AudioSource.VOICE_COMMUNICATION作为AudioRecord实例中的源代码,用于所有支持此功能的设备。这在我所有的药片上都很好,除了一片。“宏碁Iconia Tab 8”。
AcousticEchoCanceler,AutomaticGainControl,NoiseSuppressor是可用的。安卓版本为4.4.2
接收设备只接收带有嗡嗡声的音频数据。如果我使用的是不支持AudioSource.MIC的设备在回退时使用的AudioSource.VOICE_COMMUNICATION,那么它可以工作,但是没有需要并且应该由该设备支持的EchoCancelation。
final int bufSize = Math.max(1 * 2 * 8000, AudioRecord.getMinBufferSize(8000, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT));
AudioRecord rec;
try {
final int src = MediaRecorder.AudioSource.VOICE_COMMUNICATION;
rec = new AudioRecord(src, 8000, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, bufSize);
} catch (IllegalArgumentException e) {
Log.d("AudioRecorder", "echo cancellation NOT enabled (old android version)");
final int src = MediaRecorder.AudioSource.MIC;
rec = new AudioRecord(src, 8000, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, bufSize);
}有人对这种奇怪的行为有什么想法吗?
发布于 2015-01-28 12:48:32
我也遇到了同样的问题,并通过升级Android来解决这个问题。
https://stackoverflow.com/questions/27019105
复制相似问题