(8.D.2.4) AGCCompressorCoreFract32
Overview
Gain computer for use in Compressor
Discussion
This module takes as input the max absolute value of the inputs, 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.
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 _ModuleAGCCompressorCoreFract32
{
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; // Slope of the output attenuation when the signal is above threshold - derived from the standard compression ratio parameter by the formula slope = 1.0 - (1.0/ratio).
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.
fract32 currentGain; // Instanteous gain applied at the end of the block.
fract32 thresholdFract32; // threshold - in 8.24 "base2 dB"
fract32 gainFract32; // outputGain - in 8.24 "base2 dB"
fract32 slope; // Internal parameter which holds the slope of the compression curve.
FLOAT32 sharpnessFactor; // Unused variable. Kept in for legacy support
fract32 attackCoeff; // Internal derived coefficient based on the attackTime
fract32 attackCoeffSmoothing; // Internal derived coefficient based on the attackTimeMin
fract32 decayCoeff; // Internal derived coefficient based on decayTime
fract32 decayCoeffSmoothing; // Internal derived coefficient based on decayTimeMin
fract32 envState; // State of the envelope detector one-pole filter - runs at tick rate.
} ModuleAGCCompressorCoreFract32Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
threshold | float | parameter | 0 | -30 | -60:0 | dB |
gain | float | parameter | 0 | 10 | 0:100 | dB |
ratio | float | parameter | 0 | 4 | 1:100 | Â |
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 | fract32 | state | 0 | 0 | Unrestricted | Â |
thresholdFract32 | fract32 | derived | 0 | -0.2344 | Unrestricted | Â |
gainFract32 | fract32 | derived | 0 | 0.07813 | Unrestricted | Â |
slope | fract32 | derived | 1 | 0.005859 | 0:100 | dB/dB |
sharpnessFactor | float | derived | 1 | 0 | Unrestricted | Â |
attackCoeff | fract32 | derived | 1 | 1 | Unrestricted | Â |
attackCoeffSmoothing | fract32 | derived | 1 | 0.001041 | Unrestricted | Â |
decayCoeff | fract32 | derived | 1 | 0.01324 | Unrestricted | Â |
decayCoeffSmoothing | fract32 | derived | 1 | 0.0004166 | Unrestricted | Â |
envState | fract32 | state | 1 | 0 | Unrestricted | Â |
Pins
Input Pins
Name: in
Description: audio input
Data type: fract32
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: fract32
MATLAB Usage
File Name: agc_compressor_core_fract32_module.m
M=agc_compressor_core_fract32_module(NAME)
Fract32 compressor core module for use in Audio Weaver. Arguments:
NAME - name of the module.
Â