I am testing the WebRTC AGC but I must be doing something wrong because the signal just passes through unmodified.
Here's how I create and initialize the AGC:
agcConfig.compressionGaindB = 9; agcConfig.limiterEnable = 1; agcConfig.targetLevelDbfs = 9; /* 9dB below full scale */ WebRtcAgc_Create(&agc); WebRtcAgc_Init(agc, minLevel, maxLevel, kAgcModeFixedDigital, 8000); WebRtcAgc_set_config(agc, agcConfig);
And then for each 10ms sample block I do the following:
WebRtcAgc_Process(agc, micData, NULL, 80, micData, NULL, micLevelIn, &micLevelOut, 0, &saturationWarning);
Where micLevelIn
is set to 0.
Can somebody tell me what I'm doing wrong?
I expected that a full scale sine tone would be attenuated to the target DBFS level; and a low level sine tone (i.e. -30dBFS) would be amplified to match the target DBFS level. But that's not what I'm seeing.
Automatic Gain Control (AGC) AGC is a system that controls the increase in the amplitude of an electrical signal from the original input to the amplified output, automatically.
The most important advantage of AGC is that it is very fast to apply and does not require complicated processing parameters to be selected accurately. However, it also has a very substantial disadvantage: it completely removes relative amplitude information embedded in the seismic data.
Those who are recording for quality will want to turn AGC off. In our opinion, we'd always turn AGC off and make any changes to your environment for clearer sound. You can turn off appliances to reduce their noise or adjust the thermostat so your heating or air conditioning doesn't kick on while recording.
Here is the sequence of operations to be used for Webrtc_AGC:
WebRtcAgc_Create
WebRtcAgc_Init
WebRtcAgc_set_config
capture_level = 0
kAgcModeAdaptiveDigital
, invoke VirtualMic: WebRtcAgc_VirtualMic
capture_level
: WebRtcAgc_Process
WebRtcAgc_Process
and set it to capture_level
audio buffers
WebRtcAgc_Free
Check webrtc/modules/audio_processing/gain_control_impl.cc for reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With