Skip to content

AGCAttackRelease

Overview

Multi-channel envelope detector with programmable attack and release times

Discussion

Envelope detector used in dynamics processor. The module accepts an N-channel buffer of amplitude and produces an output buffer the same size as the input. An envelope detector is applied to the input that has programmable attack and release times. The attack time applies when the current input value is larger than the state of the envelope detector. Similarly, the release time applies when the current input value is smaller than the state of the envelope detector.

Module Pack

Advanced

ClassID

classID = 1201

Type Definition

typedef struct _ModuleAGCAttackRelease
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
FLOAT32 attackTime;                           // Speed at which the detector reacts to increasing levels.
FLOAT32 releaseTime;                          // Speed at which the detector reacts to decreasing levels.
FLOAT32 attackCoeff;                          // Internal coefficient realizing the attack time.
FLOAT32 releaseCoeff;                         // Internal coefficient realizing the release time.
FLOAT32* envStates;                           // Vector of sample-by-sample states of the envelope detectors; each column is the state for a channel.
} ModuleAGCAttackReleaseClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
attackTime float parameter 0 2 0.01:1000 msec
releaseTime float parameter 0 100 0.01:1000 msec
attackCoeff float derived 1 0.01036 Unrestricted
releaseCoeff float derived 1 0.0002083 Unrestricted
envStates float* state 1 [1 x 1] 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_attack_release_module.m 
 M=agc_attack_release_module(NAME) 
 Envelope detector with programmable attack and release time constants. 
 Arguments: 
    NAME - name of the module. 

 Copyright 2009-2020.  DSP Concepts, Inc.  All Rights Reserved. 

Copyright (c) 2026 DSP Concepts, Inc.