AGCVariableAttackRelease
Overview
Peak follower with variable attack and release rates
Discussion
The AGCVariableAttackRelease module provides program-dependent peak following. This module has 2 attack time constants and 2 release time constants. When it is attacking, it will start by using the attackTimeInitial time constant. As the output level approaches the input level, it will smoothly vary to the attackTimeFinal time constant Likewise for release. This module also has an optional freeze pin. When the freeze pin is 1, then the state variable and the output values are frozen. When the freeze pin is deasserted, this module will continue operation from previous state.
Type Definition
typedef struct _ModuleAGCVariableAttackRelease
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 attackTimeInitial; // Envelope detector initial attack time constant
FLOAT32 attackTimeFinal; // Envelope detector final attack time constant
FLOAT32 releaseTimeInitial; // Envelope detector initial release time constant
FLOAT32 releaseTimeFinal; // Envelope detector final release time constant
FLOAT32 attackCoefInitial; // Computed coefficient used for initial attack
FLOAT32 attackCoefFinal; // Computed coefficient used for final attack
FLOAT32 releaseCoefInitial; // Computed coefficient used for initial release
FLOAT32 releaseCoefFinal; // Computed coefficient used for final release
INT32 attackMode; // Internal variable to keep track of the last mode (1 = attack, 0 = release, -1 = not started)
FLOAT32 state; // Internal state variable. This is also the instantaneous output value.
FLOAT32 startLevel; // Internal state variable to keep track of the initial value of the attack or release phase
} ModuleAGCVariableAttackReleaseClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
attackTimeInitial | float | parameter | 0 | 0.01 | 0.001:100 | msec |
attackTimeFinal | float | parameter | 0 | 0.01 | 0.001:100 | msec |
releaseTimeInitial | float | parameter | 0 | 1 | 0.01:100 | msec |
releaseTimeFinal | float | parameter | 0 | 50 | 0.01:1000 | msec |
attackCoefInitial | float | derived | 1 | 0.8755 | Unrestricted | |
attackCoefFinal | float | derived | 1 | 0.8755 | Unrestricted | |
releaseCoefInitial | float | derived | 1 | 0.02062 | Unrestricted | |
releaseCoefFinal | float | derived | 1 | 0.0004166 | Unrestricted | |
attackMode | int | state | 1 | -1 | Unrestricted | |
state | float | state | 1 | 0 | Unrestricted | |
startLevel | float | state | 1 | 0 | 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
Name: freeze
Description: freezes the output and state variables
Data type: int
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: agc_variable_attack_release_module.m
M=agc_variable_attack_release_module(NAME, FREEZEPIN)
Program dependent attack release envelope follower. The attack and
decay will smoothly vary between 2 user-specified values, depending
on the amplitude characteristics of the signal being processed.
Arguments:
NAME - name of the module.
FREEZEPIN - Optional boolean variable that specifies if the module has
a freeze pin. By default, FREEZEPIN = 0.