如何禁用 HTC EVO (Supersonic) 上的 AGC?

发布于 2024-09-04 10:10:03 字数 1073 浏览 2 评论 0原文

我正在开发一个应用程序,需要对从麦克风捕获的原始 PCM 音频执行识别算法。在我测试过的所有 Android 设备上,PCM 数据都是可用的(即原始音频数据)。新 Sprint EVO 的情况并非如此。

Sprint EVO 的麦克风上有 AGC(自动增益控制),这会破坏数据,导致我们的识别算法不再起作用。

我相信这是 HTC 添加到该设备(可能还有未来设备)操作系统中的一项功能。我已经在使用相同操作系统版本 (2.1) 的其他一些设备上测试了我们的应用程序,并且这些其他设备运行正常。

不幸的是,HTC 尚未发布该设备上使用的代码。我预计我可能必须使用 JNI 才能绕过此特定设备的此操作,并且我愿意这样做,但如果无法访问 HTC 源代码,我将不知道从哪里开始。

没有办法扭转 AGC 的影响,所以我一直在尝试解决它。

更具体的信息:

我正在使用 AudioRecorder 来访问原始 PCM 数据。我尝试过一些使用 MediaRecorder 记录 AMR 数据的程序,这些记录也表现出相同的 AGC 属性。

我尚未尝试的一件事是编写自己的例程来使用 MediaRecorder 并使用 setAudioSource(AudioSource.VOICE_RECOGNITION)。我能找到的关于这个标志的唯一文档来自 Android 参考,其中简单地指出“为语音识别而调整的麦克风音频源(如果可用),否则行为类似于默认值”。这可能是我所需要的,但需要解码 AMR 数据的额外步骤才能获取 PCM 数据(如果必须的话我会这样做。)

如果有人知道有关此新“功能”的任何信息,请提供任何信息将不胜感激。具体来说,如果我能回答以下任何一个问题,我的生活就会好得多:

  1. 这个新功能是 HTC 特有的吗?
  2. HTC 何时发布 EVO/Supersonic 的代码库?
  3. 还有其他人遇到过这个问题并找到解决该问题的方法吗?
  4. AudioSource.VOICE_RECOGNITION 实际上会阻止 AGC 吗?
  5. AudioSource.VOICE_RECOGNITION 的存在是否表明这在未来的设备中会更常见,并且该标志是绕过它的规定?

任何其他线索、提示、技巧将不胜感激。

I'm working on an application that needs to perform recognition algorithms on raw PCM audio captured from the microphone. On all Android devices I've tested, the PCM data is usable (i.e., raw audio data.) This is not the case for the new Sprint EVO.

The Sprint EVO has AGC (Auto Gain Control) on the mic, which destroys the data such that our recognition algorithms no longer work.

I believe this is a feature that HTC added to the OS for this device (and possibly future devices.) I've tested our application on a few other devices using the same OS version (2.1) and these other devices behave normally.

Unfortunately, HTC has not yet posted the code used on this device. I expect that I may have to use JNI in order to bypass this for this specific device, and I'm willing to do this, but without access to the HTC source, I wouldn't know where to begin.

There is no way to reverse the effects of AGC, so I'm stuck trying to work around it.

More specific information:

I'm using AudioRecorder in order to get access to the raw PCM data. I've tried a few programs that use MediaRecorder to record AMR data and those recordings also exhibit the same AGC properties.

One thing I have yet to try, is to write my own routines to use MediaRecorder and use setAudioSource(AudioSource.VOICE_RECOGNITION). The only documentation I can find on this flag is from the Android reference, which simply states "Microphone audio source tuned for voice recognition if available, behaves like DEFAULT otherwise." This may be what I need, but would require the extra step of decoding the AMR data in order to get the PCM data (which I'll do if I have to.)

If anybody knows anything about this new "feature", any information would be greatly appreciated. Specifically, my life would be much better if I had the answers to any of the following questions:

  1. Is this new feature specific to HTC?
  2. When will HTC release their codebase for the EVO/Supersonic?
  3. Has anybody else run into this and found a way to work around the issue?
  4. Does AudioSource.VOICE_RECOGNITION actually prevent AGC?
  5. Does the existence of AudioSource.VOICE_RECOGNITION indicate that this is expected to be more common in future devices and this flag is a provision for bypassing it?

Any other clues, hints, tips would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

微凉徒眸意 2024-09-11 10:10:03

事实证明,我在浏览Android git depot时找到了解决方案:

AudioRecord ar = 
    new AudioRecord(MediaRecorder.AudioSource.VOICE_RECOGNITION, ...);

对于运行OS 2.1及以上版本的设备,这可以让你接收到不受AGC影响的音频流,仍然是高质量的16位PCM数据溪流。

我的应用程序目标版本为 1.5 及更高版本,并且直到 API 级别 7 (OS 2.1) 才支持此 VOICE_RECOGNITION 标志。然而,由于 EVO 运行 v2.1,而且我相对有信心这对于 OS 2.1 之前的任何设备都不会成为问题,因此简单的版本检查可以将解决方案限制为仅需要/的设备支持它。

As it turns out, I found the solution while browsing the Android git depot:

AudioRecord ar = 
    new AudioRecord(MediaRecorder.AudioSource.VOICE_RECOGNITION, ...);

For devices running OS 2.1 and above, this allows you to receive an audio stream that is not affected by AGC and is still a high-quality 16-bit PCM data stream.

I'm targetting my app at 1.5 and above, and this VOICE_RECOGNITION flag isn't supported until API Level 7 (OS 2.1). However, since the EVO runs v2.1 and I'm relatively confident that this won't be a problem for any device prior to OS 2.1, a simple version check will do the trick to limit the solution to only those devices that need/support it.

我不是你的备胎 2024-09-11 10:10:03

不幸的是,

AudioRecord ar = 
    new AudioRecord(MediaRecorder.AudioSource.VOICE_RECOGNITION, ...);

这不是一个通用的解决方案。即使选择了 MediaRecorder.AudioSource.VOICE_RECOGNITION,某些制造商也会应用 AGC。他们只是忽略了谷歌的“兼容性定义”。请参阅如何避免使用 AudioRecord 进行自动增益控制?

Unfortunately,

AudioRecord ar = 
    new AudioRecord(MediaRecorder.AudioSource.VOICE_RECOGNITION, ...);

is not a general solution. Some manufacturers apply AGC even if MediaRecorder.AudioSource.VOICE_RECOGNITION is chosen. They simply ignore Google's "Compatibility Definition". See How avoid automatic gain control with AudioRecord?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文