Document toolboxDocument toolbox

(8.D.2.7) AGCCompressorCore

Overview

Gain computer used to realize compressors

Discussion

This module accepts a mono input, takes the absolute value, computes an envelope follower (with settable attack and decay rates), and computes the appropriate gain based on threshold, gain, and slope parameters. The output has a linear gain factor. The computation is performed once per tick. If you have a multichannel input, then use the max_abs_module.m to compute the absolute value across multiple channels.

The envelope follower uses the maximum value of the input within the tick for its calculation. The output gain is smoothed with a one-pole smoother to reduce zipper noise.

Type Definition

typedef struct _ModuleAGCCompressorCore { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 threshold; // Amplitude level at which the AGC Limiter Core reduces its output gain value. FLOAT32 gain; // Value used to scale the output of the AGC Limiter Core. FLOAT32 ratio; // Specifies the amount of attenuation (and gain) when above (or below) the threshold. FLOAT32 attackTime; // Envelope detector attack time constant. FLOAT32 attackTimeMin; // Minimum value of the attack time constant. FLOAT32 decayTime; // Envelope detector decay time constant. FLOAT32 decayTimeMin; // Minimum value of the decay time constant. FLOAT32 currentGain; // Instantaneous gain applied at the end of the block. FLOAT32 slope; // Internal parameter which holds the slope of the compression curve. FLOAT32 sharpnessFactor; // Unused variable. Kept in for legacy support FLOAT32 attackCoeff; // Internal derived coefficient based on the attackTime FLOAT32 attackCoeffSmoothing; // Internal derived coefficient based on the attackTimeMin FLOAT32 decayCoeff; // Internal derived coefficient based on decayTime FLOAT32 decayCoeffSmoothing; // Internal derived coefficient based on decayTimeMin FLOAT32 envState; // State of the envelope detector one-pole filter - runs at tick rate. } ModuleAGCCompressorCoreClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

threshold

float

parameter

0

-20

-60:0

dB

gain

float

parameter

0

1

0:100

dB

ratio

float

parameter

0

4

1:100

dB/dB

attackTime

float

parameter

0

20

20:100

msec

attackTimeMin

float

parameter

0

20

Unrestricted

 

decayTime

float

parameter

0

100

20:1000

msec

decayTimeMin

float

parameter

0

20

Unrestricted

 

currentGain

float

state

0

0

-20:20

 

slope

float

derived

1

0.75

0:100

dB/dB

sharpnessFactor

float

derived

1

0

Unrestricted

 

attackCoeff

float

derived

1

1

Unrestricted

 

attackCoeffSmoothing

float

derived

1

0.001041

Unrestricted

 

decayCoeff

float

derived

1

0.01324

Unrestricted

 

decayCoeffSmoothing

float

derived

1

0.0004166

Unrestricted

 

envState

float

state

1

0

Unrestricted

 

Pins

Input Pins

Name: in

Description: audio input

Data type: float

Channel range: 1

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: float

MATLAB Usage

File Name: agc_compressor_core_module.m

M=agc_compressor_core_module(NAME) Creates a gain computation part of a compressor. It is used in conjunction with the AGCMultiplier to implement full compressor. Arguments: NAME - name of the module.

Â