如何避免使用 AudioRecord 进行自动增益控制? [英] How avoid automatic gain control with AudioRecord?

查看:23
本文介绍了如何避免使用 AudioRecord 进行自动增益控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 android.media.AudioRecord 进行录音,而无需任何依赖于智能手机制造商的花哨信号处理,例如自动增益控制 (AGC) 和/或均衡、噪声抑制、回声消除、...只是纯麦克风信号?

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 提供九个常量,

  • DEFAULTMIC 最初存在,
  • VOICE_UPLINKVOICE_DOWNLINKVOICE_CALL 添加到 API 级别 4,
  • CAMCORDERVOICE_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.

在 API 级别 20 中添加第十个常量(如 PURE_MIC)会很好.

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?

推荐答案

简短的回答是没什么".

Short answer is "Nothing".

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 自身设定的内部声学要求.此过程可能会导致在硬件编解码器或多媒体 DSP 级别将各种滤波器(例如 AGC、噪声抑制、均衡等)引入音频输入路径.

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 写入硬件编解码器的 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.

这篇关于如何避免使用 AudioRecord 进行自动增益控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆