views:

218

answers:

2

Hi all!

I'm looking for solution to tune mic's level in my VoIP app. I can get a level of sound, but want also tune 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 hihg/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!

A: 

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.

Paul R
Hi Paul, thank you for reply. Yes, AGC. I'm asking here exactly 'cause I don't think that it can be implemented in 2 lines of code.It will be perfect to find a .Net solution or even detailed description of such algorithm.
Dmitry Kadantsev
A: 

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

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

jinsungy
Hi, thanks for reply. I have no problem with a capturing of current signal value at any moment. The problem is - how to tune mic's gain/volume depending on existing information about current and past mic's levels to hold a sound's volume in desired range? This is a point.
Dmitry Kadantsev