AGC
Overview
The AGC, or automatic gain control, compares the envelope, env
, to an external reference, ref
, and increases or decreases the gain to maintain a constant output level. A class named agc
implements AGC.
Envelope tracking is done externally using an external envelope follower to make it possible to use different types of envelope tracking schemes, the output of which is the supplied argument to the function call operator.
The agc
is an envelope processor that operates on the envelope of the audio signal, performs computations in the logarithmic domain, and returns a processed envelope.
See Dynamic for further details. |
agc
is a feedforward type AGC." In contrast to feedback AGCs, feedforward AGCs derive their control signal only from the input signal and an external reference set-point.
Declaration
struct agc
{
agc(decibel max);
decibel operator()(decibel env, decibel ref) const;
void max(decibel max_);
decibel max() const;
};
Expressions
Constructors and Assignment
Expression | Semantics |
---|---|
|
Construct an |
|
Copy construct from |
|
Assign |
C++ brace initialization may also be used. |
As previously stated, the agc
compares the envelope, env
, to an external reference, ref
, and adjusts the gain accordingly to maintain a constant output level. However, there is a maximum gain that can be applied when the signal falls below the reference. The max
constructor parameter specified this "maximum" gain.
Function Call
Expression | Semantics | Return Type |
---|---|---|
|
Process the input envelope |
|
The output is the adjusted gain, also in decibels
. Simply multiply the signal by the result converted to float
using as_float
(or double
using as_double
). For example:
auto gain = as_float(g(env, ref)); (1)
auto out = signal * gain; (2)
1 | env is the computed envelope (e.g.) using an envelope follower.
gain is obtained from the env processed by agc and converted to float . |
2 | The signal multiplied by gain . |