如何避免与AudioRecord自动增益控制?自动增益控制、AudioRecord

2023-09-12 09:28:44 作者:懒男神。

我能如何使用 android.media.AudioRecord 录音没有像自动增益控制(AGC)和/或均衡任何智能手机制造商依赖花哨的信号处理,噪音燮pression,回声消除,...只是单纯的麦克风信号?

How can I do audio recordings using android.media.AudioRecord without any smartphone-manufacturer-dependent fancy signal processing like automatic gain control (AGC) and/or equalization, noise suppression, echo cancellation, ... just the pure microphone signal?

MediaRecorder.AudioSource 提供九路常数,

默认 MIC 最初在那里, VOICE_UPLINK VOICE_DOWNLINK VOICE_CALL 的补充API级别4, 摄像机 VOICE_RECOGNITION 的API 7加, VOICE_COMMUNICATION 添加API 11, REMOTE_SUBMIX 在API 19添加,但不提供给第三方应用程序。 DEFAULT and MIC initially being there, VOICE_UPLINK, VOICE_DOWNLINK, and VOICE_CALL added in API level 4, CAMCORDER and VOICE_RECOGNITION added in API 7, VOICE_COMMUNICATION added in API 11, REMOTE_SUBMIX added in API 19 but not available to third-party applications.

但他们都不做所有的智能手机清洁工作。相反,我必须找出自己看来,这装置使用,其中信号处理模块组合而 MediaRecorder.AudioSource 不变。

But none of them does a clean job across all smartphones. Rather, I have to find out myself it seems, which device uses which combinations of signal processing blocks for which MediaRecorder.AudioSource constant.

将是不错的第十个恒定的如 PURE_MIC 在API级别20加入。

Would be nice to have a tenth constant like PURE_MIC added in API level 20.

但只要这是不可用,我该怎么办呢?

But as long as this is not available, what can I do instead?

推荐答案

简短的回答是没有。

在AudioSources对应不同的逻辑音频输入设备,具体取决于您已连接到手机和目前的使用情况,这反过来又对应于物理设备(主要内置的麦克风,二级麦克风,有线耳机麦克风配件等),不同的调音。

The AudioSources correspond to various logical audio input devices depending on the accessories that you have connected to the phone and the current use-case, which in turn corresponds to physical devices (primary built-in mic, secondary mic, wired headset mic, etc) with different tunings.

的物理设备和调谐每个这样的组合由OEM修整以满足外部要求(例如CTS,运营商的要求,等等)和内部声学要求由OEM本身设置。此过程可能导致引入各种滤波器的 - 如AGC,噪声SUP pression,均衡,等等 - 成在硬件codec或多媒体的DSP水平的音频输入路径

Each such combination of physical device and tuning is trimmed by the OEM to meet both external requirements (e.g. CTS, operator requirements, etc) and internal acoustic requirements set by the OEM itself. This process may cause the introduction of various filters - such as AGC, noise suppression, equalization, etc - into the audio input path at the hardware codec or multimedia DSP level.

虽然 PURE_MIC 来源可能是在对某些应用非常有用,它不是今天就是可用的。照片 在许多设备上,你可以控制的东西像麦克风增益,甚至可能是过滤器链,使用 amixer 写入硬件codeC的ALSA控制。然而,这显然是一个非常特定于平台的做法,我也怀疑,你必须运行为root或音频用户被允许这样做。

While a PURE_MIC source might be useful in for some applications, it's not something that's available today. On many devices you can control things like microphone gain, and possibly even the filter chain, by using amixer to write to the hardware codec's ALSA controls. However, this would obviously be a very platform-specific approach, and I also suspect that you have to be running as either the root or audio user to be allowed to do this.