麦克风自动调平

发布于 2024-08-20 22:32:57 字数 245 浏览 7 评论 0原文

我正在寻找在 VoIP 应用程序中调整麦克风电平的解决方案。我可以获得一定程度的声音,但也想在麦克风的“音量”太低或太高时实时调整。就像在 Skype 中一样......

事实上看起来很简单,但我认为该算法应该比在电平超过高/低限制时调节音量更聪明一些。

我在Win平台上使用.Net 2.0。是否有任何现成的 .Net 库或什至 C 库(以便我可以移植它),甚至只是此类方法/算法的描述?我尝试用谷歌搜索但没有运气。

谢谢你!

I'm looking for solution to tune mic's level in my VoIP app. I can get a level of sound, but also want to tune the mic's "volume" when it too low or too high in real-time. Like in Skype...

It looks easy ex facte, but I think the algorithm should be a bit smarter then just turning the volume when level comes over high/low limits.

I'm using .Net 2.0 on Win platform. Are there any ready libraries for .Net or even on C (so I can port it) or even just description of such methods/algorithms? I've tried to google but with no luck.

Thank you!

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

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

发布评论

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

评论(4

行雁书 2024-08-27 22:32:57

这有两个部分。

首先,您需要开始从麦克风捕获音频并测量其信号强度。如果一个人对着麦克风说话来校准它,您可以简单地查找前几秒钟的最高峰值。如果低于-6dB(例如),则稍微提高增益,如果高于-3dB,则稍微降低增益。关键是您需要高信噪比,但无论如何您都希望避免信号太大而导致削波或失真。

第二部分是确定混音器 API 返回的众多混音器控件中的哪一个是控制麦克风增益的控件。事实证明,这比应有的要困难得多,特别是如果您希望它能够与所有声卡以及 XP 和 Vista/Win 7 一起工作。请参阅 这个问题获取一些建议的解决方案。

您可以将 NAudio 用于这两个部分。它具有waveIn 和mixer API 的包装器。

There are two parts to this.

First, you need to start capturing audio from the microphone and measure its signal intensity. If a person is speaking into the microphone to calibrate it, you could simply look for the highest peak over the previous few seconds. If it is below -6dB (say), raise the gain a bit, if it is above -3dB, reduce it a bit. The point is that you want high signal to noise ratio, but at all costs you want to avoid clipping or distortion with a signal too loud.

The second part is to work out which of the multitude of mixer controls returned by the mixer APIs is the one controlling the microphone gain. This turns out to be much harder than it ought to be, particularly if you want it to work with all sound cards and on XP and Vista/Win 7. See this question for some suggested solutions.

You can use NAudio for both parts. It has wrappers for the waveIn and mixer APIs.

自我难过 2024-08-27 22:32:57

通常使用的名称是AGC(自动增益控制),但它并不那么容易听起来。在基本的 AGC 方案中,您有一个快速“攻击”,这意味着当输入电平增加时,您会非常快地降低增益,然后当输入电平下降时,使用较大的时间常数更缓慢地增加增益。

The commonly used name for this is AGC (Automatic Gain Control) and it is not quite as easy as it sounds. In a basic AGC scheme you have a fast "attack", which means that you reduce the gain very quickly when the input level increases, and then use a larger time constant to increase the gain more slowly when the input level drops.

酒浓于脸红 2024-08-27 22:32:57

首先尝试一下:获取并设置波浪声音卷

它通过 P/Invoke 在 C# 中使用 Windows API。

Try this for a start: Get and set the wave sound volume

It uses Windows API in C# through P/Invoke.

恏ㄋ傷疤忘ㄋ疼 2024-08-27 22:32:57

我建议使用 Speex 预处理器。作为奖励,您可以获得噪音抑制。

我的 Xiph 项目包含对其的绑定:
https://github.com/CodesInChaos/Xiph

特别是您需要这两个文件:
https://github.com/CodesInChaos/Xiph/blob/master /Easy/Speex/SpeexPreProcessor.cs
https://github.com/CodesInChaos/Xiph/blob/master/LowLevel /SpeexPreProcessor.cs

这可能不是生产质量,而是一个起点。如果您改进了它们,请将更改发送给我。

I recommend using the Speex-Pre-Processor. As a bonus you get noise suppression.

My Xiph project contains bindings to it:
https://github.com/CodesInChaos/Xiph

In particular you need these two files:
https://github.com/CodesInChaos/Xiph/blob/master/Easy/Speex/SpeexPreProcessor.cs
https://github.com/CodesInChaos/Xiph/blob/master/LowLevel/SpeexPreProcessor.cs

It's probably not production quality, but a starting point. If you improve them please sent me the changes.

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