Skip to content

AGCNoiseGateCore

Overview

Gain computer used to realize noise gates

Discussion

On/off style noise gate, where the volume is muted (via a crossfade) when it falls below a certain threshold, and it turns back on (via a crossfade) when it rises back above a threshold. The module is designed to take a multichannel signal as its input, and outputs a mono gain control signal to be used with the MultiplierV2 module. The input signal level is determined by a variant of RMS, where separate time constants are used for the attack and release portions of the input signal. Hysteresis is incorporated within the module to avoid gain oscillation around the threshold. The delta parameter is used in conjunction with the threshold parameter to establish the bounds of the hysteresis. When the input RMS falls below threshold-delta, the noise gate enters into its muted state, and the output gain control signal will ramp from 1.0 to 0.0 at a rate determined by the crossfadeTime parameter. When the input RMS is above threshold-delta, the noise gate will ramp the output gain control signal back to 1.0.

Module Pack

Standard

ClassID

classID = 3

Type Definition

typedef struct _ModuleAGCNoiseGateCore
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
FLOAT32 threshold;                            // Activation threshold of the noise gate, in decibels. When the RMS gain dips below (threshold-delta), the output gain will be ramped to zero (-inf dB).
FLOAT32 delta;                                // Hysterisis width of the noise gate, in decibels. When the RMS gain dips below the dB value of (threshold-delta), the output gain will be ramped to zero (-inf dB). The output gain will return to 0 dB when the input RMS value rises above (threshold+delta).
FLOAT32 attackTime;                           // Attack time of the noise gate. This controls the RMS smoothing interval when the input is increasing in volume, and the time constant of the smoothly updating gain
FLOAT32 releaseTime;                          // Decay time of the noise gate. This controls the RMS smoothing interval when the input is decreasing in volume, and the time constant of the smoothly updating gain
FLOAT32 crossfadeTime;                        // Response time of the noise gate. This controls the time constant of the smoothly updating output gain
INT32 isMuted;                                // Boolean that determines whether the output is muted (isMuted=1) or active (isMuted=0).
FLOAT32 lowerThreshold;                       // Lower activation threshold of the noise gate, in linear units. Computed as undb10f(threshold-delta).
FLOAT32 upperThreshold;                       // Upper activation threshold of the noise gate, in linear units. Computed as undb10f(threshold-delta).
FLOAT32 attackCoeffBlock;                     // Block-by-block smoothing coefficient for the attack portion of the RMS measurement. Set via smoothingTime.
FLOAT32 releaseCoeffBlock;                    // Block-by-block smoothing coefficient for the release portion of the RMS measurement. Set via smoothingTime.
FLOAT32 smoothingCoeffOutput;                 // Sample-by-sample smoothing coefficient for the output gain adjustment. Set via crossfadeTime.
FLOAT32 targetGain;                           // Target gain of the smoothing operation.
FLOAT32 currentGain;                          // Instanteous gain of the smoothing operation.
FLOAT32 energy;                               // Smoothed energy measurement.
FLOAT32 oneOverNumSamples;                    // 1 divided by the number of samples in the input pin. Used internally by the algorithm in order to save a divide operation.
} ModuleAGCNoiseGateCoreClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
threshold float parameter 0 -40 -100:0 dB
delta float parameter 0 3 0:20 dB
attackTime float parameter 0 10 1:5000 msec
releaseTime float parameter 0 500 1:5000 msec
crossfadeTime float parameter 0 20 1:100 msec
isMuted int state 0 0 0:1
lowerThreshold float derived 1 5.012e-05 Unrestricted
upperThreshold float derived 1 0.0001995 Unrestricted
attackCoeffBlock float derived 1 0.06449 Unrestricted
releaseCoeffBlock float derived 1 0.001332 Unrestricted
smoothingCoeffOutput float derived 1 0.001041 Unrestricted
targetGain float state 1 0 Unrestricted
currentGain float state 1 0 Unrestricted
energy float state 1 0 -80:10
oneOverNumSamples float state 1 0.03125 Unrestricted

Pins

Input Pins

Name in
Description Audio input
Data type float
Channel range Unrestricted
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: agc_noise_gate_core_module.m 
 M=agc_noise_gate_core_module(NAME) 
 Audio Weaver module which mutes the output gain value if the input RMS 
 value is less than the threshold. The module generates a smoothed gain 
 control signal for fading the signal in and out, and incorporates  
 hysteresis to avoid gain oscillation around the threshold. 

 Arguments: 
    NAME - name of the module. 

Copyright (c) 2026 DSP Concepts, Inc.