DownwardExpanderCore
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 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.
Module Pack
Advanced
ClassID
classID = 1263
Type Definition
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
} ModuleDownwardExpanderCoreClass;
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 | float | state | 0 | 0 | -10:5 | db20 |
| attackCoeff | float | derived | 1 | 0.001041 | Unrestricted | |
| decayCoeff | float | derived | 1 | 0.0002083 | Unrestricted | |
| envState | float | state | 1 | 0 | -100:1 | db20 |
| kneePoly | float* | derived | 1 | [1 x 3] | 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: downward_expander_core_module.m
M=downward_expander_core_module(NAME)
Creates a 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.
Copyright (c) 2026 DSP Concepts, Inc.