Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Scroll Documents: Update page title prefix

Overview

Slowly varying RMS based gain computer

Discussion

The AGCCore module is a slowly varying dynamics computer based on the RMS level of the signal. The module is used inconjunction with the MultiplierV2 module to create automatic gain controls. The module outputs a linear gain which can be applied to another signal using the MultiplierV2 module.

...

When the input level falls below .activationThreshold then the AGC freezes and holds its output gain. If .enableRecovery is checked then when the input signal falls below .activationThreshold then the AGCCore's gain will slew back to 0 dB. The rate of slewing is specified by recoveryRate which has units of dB/sec.

Type Definition

Code Block
typedef struct _ModuleAGCCore
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    FLOAT32 targetLevel;                          // Target audio level.
    FLOAT32 maxAttenuation;                       // Maximum attenuation of the AGC.
    FLOAT32 maxGain;                              // Maximum gain of the AGC.
    FLOAT32 ratio;                                // Slope of the output attenuation when the signal is above threshold.
    FLOAT32 activationThreshold;                  // Activation threshold of the AGC. The AGC stops updating its gain when the instantaneous input level is below this value.
    FLOAT32 smoothingTime;                        // Response time of the AGC. This controls the RMS smoothing interval and the time constant of the smoothly updating gain.
    INT32 enableRecovery;                         // Boolean which enables the AGC's gain recovery. If enabled, the AGC slows returns 0 dB gain when the input is below the activation threshold.
    FLOAT32 recoveryRate;                         // Rate at which the gain is adjusted when the input is below the activation threshold.
    FLOAT32 currentGain;                          // Instantaneous gain of the smoothing operation.
    FLOAT32 oneOverSlope;                         // Used by the processing function to compute the amount of cut/boost. Equal to 1-1/ratio.
    FLOAT32 smoothingCoeffSample;                 // Sample-by-sample smoothing coefficient for the output gain adjustment. Set via smoothingTime.
    FLOAT32 smoothingCoeffBlock;                  // Block-by-block smoothing coefficient for the RMS measurement. Set via smoothingTime.
    FLOAT32 recoveryRateUp;                       // Recovery rate coefficient when increasing the gain (it is always >= 1).
    FLOAT32 recoveryRateDown;                     // Recovery rate coefficient when decreasing the gain (it is always <= 1).
    FLOAT32 targetGain;                           // Target gain of the smoothing operation.
    FLOAT32 energy;                               // Smoothed energy measurement.
    FLOAT32 oneOverNumSamples;                    // 1 divided by the number of samples in the input pin. Used internally by the algorithm in order to save a divide operation.
} ModuleAGCCoreClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

targetLevel

float

parameter

0

-20

-50:0.1:50

dB

maxAttenuation

float

parameter

0

100

0:100

dB

maxGain

float

parameter

0

12

0:50

dB

ratio

float

parameter

0

10

1:100

dB/dB

activationThreshold

float

parameter

0

-50

-100:-20

dB

smoothingTime

float

parameter

0

100

1:5000

msec

enableRecovery

int

parameter

0

1

0:1

recoveryRate

float

parameter

0

2.4

1:20

dB/sec

currentGain

float

state

0

0

-12:12

oneOverSlope

float

derived

1

0.9

Unrestricted

smoothingCoeffSample

float

derived

1

0.0002083

Unrestricted

smoothingCoeffBlock

float

derived

1

0.006644

Unrestricted

recoveryRateUp

float

derived

1

1

Unrestricted

recoveryRateDown

float

derived

1

0.9998

Unrestricted

targetGain

float

state

1

1

Unrestricted

energy

float

state

1

0

Unrestricted

oneOverNumSamples

float

derived

1

0.03125

Unrestricted

Pins

Input Pins

Name: in

Description: Audio input

...

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: float

MATLAB Usage

File Name: agc_core_module.m

...