AGCLimiterCoreV2
Overview
Soft knee gain computer for use in peak limiters
Discussion
The limiter core provides a peak amplitude follower and input/output gain transfer function for use in AGC systems. It is designed to take as its input the output of the BlockStatistics or the Abs module. The module outputs the time varying gain on the output pin which is typically used as input to the AGCMultiplier or a ScalerNControl module
The peak following amplitude detector and the gain transfer function may be calculated at the sample rate, which aids in reducing the gain of fast transients. 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 limiter.
V2 was introduced to allow multichannel inputs which in effect significantly reduces the module processing load compared to using multiple instances of the initial single channel version.
Module Pack
Standard
ClassID
classID = 237
Type Definition
typedef struct _ModuleAGCLimiterCoreV2
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 numChan; // Number of channels.
FLOAT32* threshold; // Amplitude level at which the AGC Limiter Core reduces its output gain value
FLOAT32* gain; // Value used to scale the output of the AGC Limiter Core (make up gain)
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* slope; // Internal derived variable which holds the slope of the compression curve
FLOAT32* sharpnessFactor; // Internal derived variable which is used to implement the soft knee
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* currentGain; // Instantaneous gain computed by the block
} ModuleAGCLimiterCoreV2Class;
Variables
Properties
| Name | Type | Usage | isHidden | Default Value | Range | Units |
|---|---|---|---|---|---|---|
| numChan | int | const | 1 | 1 | Unrestricted | |
| threshold | float* | parameter | 0 | [1 x 1] | -60:0 | dB |
| gain | float* | parameter | 0 | [1 x 1] | 0:60 | dB |
| kneeDepth | float* | parameter | 0 | [1 x 1] | 0.1:60 | dB |
| ratio | float* | parameter | 0 | [1 x 1] | 1:100 | |
| attackTime | float* | parameter | 0 | [1 x 1] | 1:2000 | msec |
| decayTime | float* | parameter | 0 | [1 x 1] | 1:2000 | msec |
| slope | float* | derived | 1 | [1 x 1] | Unrestricted | dB/dB |
| sharpnessFactor | float* | derived | 1 | [1 x 1] | Unrestricted | |
| attackCoeff | float* | derived | 1 | [1 x 1] | Unrestricted | |
| decayCoeff | float* | derived | 1 | [1 x 1] | Unrestricted | |
| envState | float* | state | 1 | [1 x 1] | Unrestricted | db20 |
| currentGain | float* | state | 0 | [1 x 1] | Unrestricted | db20 |
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 |
Scratch Pins
| Channel Count | 1 |
| Block size | 32 |
| Sample rate | 48000 |
| Channel Count | 1 |
| Block size | 32 |
| Sample rate | 48000 |
Matlab Usage
File Name: agc_limiter_core_v2_module.m
M=agc_limiter_core_v2_module(NAME)
Creates a limiter gain computer with soft knee for use in Audio
Weaver. It is used in conjunction with the AGCMultiplier to
implement full limiter.
Arguments:
NAME - name of the module.
Copyright (c) 2026 DSP Concepts, Inc.