Automatic Gain Control (AGC) and Loss Control

The Automatic Gain Control (AGC) can dynamically adapt the audio gain, or apply a fixed gain such that voice content maintains a desired output level. The AGC uses an internal Voice Activity Detector to normalise voice content and avoid amplifying noise sources and applies a soft limiter to avoid clipping on the output. The design is based on standard modern AGC techniques as detailed in ‘Acoustic Echo and Noise Control’, by Hansler and Schmidt.

The desired output level of voice content is defined by an upper and lower threshold. If a voice signal is outside of the upper and lower threshold then the gain will adapt accordingly. If the voice signal is within the upper and lower threshold then the gain will remain constant.

The rate at which the gain increases or decreases per audio frame can also be configured. The gain increment value must be greater than 1, whilst the gain decrement value must be below 1. When the gain is adapting, the current gain value is multiplied by either the increment or decrement value to calculate the gain value to be applied on the next audio frame. Voice activity is monitored and included in the algorithm to avoid the noise floor being amplified during silent periods. In addition, maximum and minimum levels may be set to keep the gain within a certain range.

The following table details the configuration parameters for the AGC. Both GET_ and SET_ operations are supported for these parameters.

Table 36 Automatic Gain Control (AGC) parameters

PARAMETER

TYPE

VALUE

DESCRIPTION

ADAPT_CH0_AGC ADAPT_CH1_AGC

uint32

[0,1]

Set to enable gain adaptation in the AGC for channel 0 or 1. 0 - adaptation disabled for the channel 1 - adaptation enabled for the channel

ADAPT_ON_VAD_CH0_AGC ADAPT_ON_VAD_CH1_AGC

uint32

[0,1]

Set to enable adaptation triggered by the Voice Activity Detector for channel 0 or 1. 0 - adaptation disabled for the channel 1 - adaptation enabled for the channel

LC_ENABLED_CH0_AGC LC_ENABLED_CH1_AGC

uint32

[0,1]

Set Loss Control to be enabled in the AGC for channel 0 or 1. 0 - Loss Control disabled for the channel 1 - Loss Control enabled for the channel

GAIN_CH0_AGC GAIN_CH1_AGC

Q16.16

[0..32767]

Set the linear gain parameter to be applied in the AGC for channel 0 or 1. Values are linear. Default: 500

MAX_GAIN_CH0_AGC MAX_GAIN_CH1_AGC

Q16.16

[0..32767]

Set the maximum gain threshold in the AGC for channel 0 or 1. Values are linear. Default: 1000

MIN_GAIN_CH0_AGC MIN_GAIN_CH1_AGC

Q16.16

[0..32767]

Set the minimum gain threshold in the AGC for channel 0 or 1. Values are linear. Default: 0

SOFT_CLIPPING_CH0_AGC SOFT_CLIPPING_CH1_AGC

uint32

[0,1]

Enable soft clipping on the output of channel 0 or 1 0 – Soft clipping disabled for the channel 1 – Soft clipping enabled for the channel

UPPER_THRESHOLD_CH0_AGC UPPER_THRESHOLD_CH1_AGC

Q1.31

[0..1]

Set the upper threshold for desired voice level. Values are in range 0 to 1 (full-scale) and must be greater than the lower threshold of the channel.

LOWER_THRESHOLD_CH0_AGC LOWER_THRESHOLD_CH1_AGC

Q1.31

[0..1]

Set the lower threshold for desired voice level. Values are in range 0 to 1 (full-scale) and must be lower than the upper threshold of the channel.

INCREMENT_GAIN _STEPSIZE_CH0_AGC INCREMENT_GAIN _STEPSIZE_CH1_AGC

Q16.16

[0..32767]

Set the rate at which the gain increases. This value is applied on a per-frame basis when voice content is detected.

DECREMENT_GAIN _STEPSIZE_CH0_AGC DECREMENT_GAIN _STEPSIZE_CH1_AGC

Q16.16

[0..32767]

Set the rate at which the gain decreases. This value is applied on a per-frame basis when voice content is detected.

The Loss Control process improves the subjective audio quality by attenuating any residual echo of the reference far-end audio. It is designed to be used on the communications channel. In cases where there is both far-end echo and near-end audio then the attenuation is reduced, allowing listeners to interrupt each other. The Loss Control relies on the Automatic Echo Canceller to classify and attenuate residual far-end echo.

The following table details the configuration parameters for the Loss Control process. Both GET_ and SET_ operations are supported for these parameters.

Table 37 Automatic Gain Control (AGC) parameters

PARAMETER

TYPE

VALUE

DESCRIPTION

LC_ENABLED_CH0_AGC LC_ENABLED_CH1_AGC

uint32

[0,1]

Set Loss Control to be enabled in the AGC for channel 0 or 1. 0 - Loss Control disabled for the channel 1 - Loss Control enabled for the channel

LC_GAINS_CH0_AGC LC_GAINS_CH1_AGC

Q16.16

[0..32767]

Loss control gains:

arg1: max arg2: double-talk arg3: silence arg4: min

LC_N_FRAMES_CH0_AGC LC_N_FRAMES_CH1_AGC

Q16.16

[0..32767]

Number of frames in loss control for near-end and far-end activity arg1: near-end arg2: far-end

LC_GAMMAS_CH0_AGC LC_GAMMAS_CH1_AGC

Q16.16

[0..32767]

Loss control gamma coefficients: background power, increment and decrement arg1: background power arg2: increment arg3: decrement

LC_DELTAS_CH0_AGC LC_DELTAS_CH1_AGC

Q16.16

[0..32767]

Loss control delta coefficients: far-end only, near-end only, both far-end and near-end arg1: far-end only arg2: near-end only arg3: both far-end and near-end

LC_CORR_THRESHOLD_CH0_AGC LC_CORR_THRESHOLD_CH1_AGC

Q1.31

[0..1]

Loss control correlation threshold for channel