(8.D.2.7) DownwardExpanderCoreFract32
Overview
Gain computer used to realize a downward expander (or noise gate)
Discussion
The downward expander core provides a peak amplitude follower and input/output gain transfer function for use in noise gating systems. It is designed to take as its input the output of the AbsModule. The module outputs the time varying fixed point gain in 8.24 format on the mono output pin which is typically used as input to the AGCMultiplierFract32Module. The peak following amplitude detector and the gain transfer function are calculated at the sample rate, which aids in reducing the gain of fast transients.
When the signal is above the threshold the output gain is 0x7FFFFFFF (no change). When the signal is below the threshold, each dB drop in the input causes the output to drop by ratio dB. For instance, a ratio of 1 results in no additional attenuation and a ratio of 11 results in 10dB more attenuation for each dB that the input drops.
The module stores the gain computed for the last sample in the block to the currentGain state variable. This variable can be examined to track the behavior of the expander.
Type Definition
typedef struct _ModuleDownwardExpanderCoreFract32
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 threshold; // Below this level the module reduces gain
FLOAT32 ratio; // Slope of the gain curve when the signal is below the threshold
FLOAT32 kneeDepth; // Knee depth controls the sharpness of the transition between expanding and not expanding
FLOAT32 attackTime; // Envelope detector attack time constant
FLOAT32 decayTime; // Envelope detector decay time constant
fract32 currentGain; // Instantaneous gain computed by the block
fract32 thresholdFract32; // threshold - in 8.24 "base2 dB"
fract32 ratioMinusOneNegate; // -(ratio - 1) - in 8.24 "base2 dB"
fract32 kneeDepthFract32; // kneeDepth - in 8.24 "base2 dB"
fract32 oneOverKneeDepthFract32; // 1/kneeDepth - in 1.31 "base2 dB"
fract32 attackCoeff; // Internal derived variable which implements the attackTime
fract32 decayCoeff; // Internal derived variable which implements the decayTime
fract32 envState; // Holds the instantaneous state of the envelope detector
fract32* kneePoly; // Derived variable for interpolating the soft knee
} ModuleDownwardExpanderCoreFract32Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
threshold | float | parameter | 0 | -20 | -100:0 | dB |
ratio | float | parameter | 0 | 5 | 0.1:100 | dB/dB |
kneeDepth | float | parameter | 0 | 0 | 0:60 | dB |
attackTime | float | parameter | 0 | 20 | 0.01:1000 | msec |
decayTime | float | parameter | 0 | 100 | 0.01:1000 | msec |
currentGain | fract32 | state | 0 | 0 | Unrestricted | Â |
thresholdFract32 | fract32 | derived | 0 | -0.002441 | Unrestricted | Â |
ratioMinusOneNegate | fract32 | derived | 0 | -0.0004883 | Unrestricted | Â |
kneeDepthFract32 | fract32 | derived | 0 | 0 | Unrestricted | Â |
oneOverKneeDepthFract32 | fract32 | derived | 0 | 0 | Unrestricted | Â |
attackCoeff | fract32 | derived | 1 | 0.001041 | Unrestricted | Â |
decayCoeff | fract32 | derived | 1 | 0.0002083 | Unrestricted | Â |
envState | fract32 | state | 1 | 0 | Unrestricted | Â |
kneePoly | fract32* | derived | 1 | [1 x 3] | 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_attack_release_module.m
M=downward_expander_core_fract32_module(NAME)
Creates a fixed point downward expander (or noise gate) module with a soft
knee. It is used in conjunction with the AGCMultiplier to implement a complete
expander. Arguments:
NAME - name of the module.
Â