Overview
Soft knee gain computer for use in peak limiters
Discussion
The agc_limiter_core_fract32_module computes a time varying gain which is used to restrict the peak value of a signal. The module is designed to take its input from the max_abs_fract32_module. The module computes a time varying gain on a sample-by-sample basis, and this gain is later applied by the agc_multiplier_fract32_module. The output gain signal is in 8.24 format. The agc_multiplier_fract32_module expects the gain to be in 1.31 format. Thus, the multiplier must be configured to shift by 7 bits. The combination of max_abs_fract32_module, agc_limiter_core_fract32_module, and agc_multiplier_fract32_module modules is referred to as a "limiter" and is contained in the script limiter_module.m.
...
The dynamic behavior of the limit is controlled by an envelop detector. attackTime specifies the rate at which sharp transients will be reduced. decayTime specifies the rate at which the limiter returns to unity gain.
Type Definition
Code Block |
---|
typedef struct _ModuleAGCLimiterCoreFract32 { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure FLOAT32 threshold; // Amplitude level at which the AGC Limiter Core reduces its output gain value FLOAT32 outputGain; // Value used to scale the output of the AGC Limiter Core fract32 slope; // TBD FLOAT32 kneeDepth; // Knee depth controls the sharpness of the transition between no limiting and limiting 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 decayTime; // Envelope detector decay time constant FLOAT32 sharpnessFactor; // TBD fract32 sharpnessFactorFract32; // TBD fract32 attackCoeff; // TBD fract32 decayCoeff; // TBD fract32 envState; // TBD fract32 currentGain; // Instanteous gain applied at the end of the block fract32 thresholdFract32; // threshold - in 8.24 "base2 dB" fract32 kneeDepthFract32; // kneeDepth - in 8.24 "base2 dB" fract32 gainFract32; // outputGain - in 8.24 "base2 dB"" } ModuleAGCLimiterCoreFract32Class; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
threshold | float | parameter | 0 | -10 | -60:0.1:0 | dB |
outputGain | float | parameter | 0 | 0 | -20:0.1:20 | dB |
slope | fract32 | derived | 0 | 0.75 | Unrestricted | dB/dB |
kneeDepth | float | parameter | 0 | 2 | 0.1:60 | dB |
ratio | float | parameter | 0 | 4 | 1:100 | |
attackTime | float | parameter | 0 | 1 | 0.01:1000 | msec |
decayTime | float | parameter | 0 | 100 | 0.01:1000 | msec |
sharpnessFactor | float | derived | 0 | 0.5 | Unrestricted | |
sharpnessFactorFract32 | fract32 | derived | 0 | 0.003906 | Unrestricted | |
attackCoeff | fract32 | derived | 0 | 0.02062 | Unrestricted | |
decayCoeff | fract32 | derived | 0 | 0.0002083 | Unrestricted | |
envState | fract32 | state | 0 | 0 | -60:1 | |
currentGain | fract32 | state | 0 | 0 | -10:5 | |
thresholdFract32 | fract32 | derived | 0 | -0.07813 | Unrestricted | |
kneeDepthFract32 | fract32 | derived | 0 | 0.01563 | Unrestricted | |
gainFract32 | fract32 | derived | 0 | 0 | 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: fract32
Scratch Pins
Channel count: 1
Block size: 32
Sample rate: 48000
MATLAB Usage
File Name: agc_limiter_core_fract32_module.m
...