Gain computer used to realize a downward expander (or noise gate)
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 gain on the mono output pin which is typically used as input to the AGCMultiplierModule. 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 1.0 (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.
typedef struct _ModuleDownwardExpanderCore
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
FLOAT32 currentGain; // Instantaneous gain computed by the block
FLOAT32 attackCoeff; // Internal derived variable which implements the attackTime
FLOAT32 decayCoeff; // Internal derived variable which implements the decayTime
FLOAT32 envState; // Holds the instantaneous state of the envelope detector
FLOAT32* kneePoly; // Derived variable for interpolating the soft knee
[1 x 3]
Description: audio input
Data type: float
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Description: audio output
Data type: float
File Name: downward_expander_core_module.m
Creates a downward expander (or noise gate) module with a soft knee.
It is used in conjunction with the AGCMultiplier to implement a complete
NAME - name of the module.