SbAttackRelease
Overview
Subband envelope detector array with programmable attack and release times
Discussion
Envelope detector array used in dynamics processor. The module accepts an N-sample buffer of amplitude and produces an output buffer the same size as the input. A separate envelope detector with programmable attack and release times is applied to each sample of the input. Subsequent samples for each detector are taken from the corresponding sample of subsequent blocks. 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. After a detector reaches its maximum value, the peak is held for holdTime msec. Only after the holdTime has elapsed does the detector start decaying. If a larger value arrives while the output is being held, the larger value overrides the holding operation, the detector attacks, and the output is held again for the specified holdTime.
Type Definition
typedef struct _ModuleSbAttackRelease
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
FLOAT32 attackTime; // Speed at which the detector reacts to increasing levels.
FLOAT32 holdTime; // Duration to hold the output constant after the peak has been reached.
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.
INT32 holdCount; // Hold time translated to the number of blocks
FLOAT32* envState; // Vector of per-sample states of the envelope detectors
INT32* holdState; // Vector of per-sample states of the envelope detectors
} ModuleSbAttackReleaseClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
attackTime | float | parameter | 0 | 2 | 0:2000 | msec |
holdTime | float | parameter | 0 | 100 | 0:1000 | msec |
releaseTime | float | parameter | 0 | 100 | 0:1000 | msec |
attackCoeff | float | derived | 1 | 0.01036 | Unrestricted | |
releaseCoeff | float | derived | 1 | 0.0002083 | Unrestricted | |
holdCount | int | parameter | 1 | 4800 | Unrestricted | |
envState | float* | state | 1 | [32 x 1] | Unrestricted | |
holdState | int* | state | 1 | [32 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: sb_attack_release_module.m
M=sb_attack_release_module(NAME)
Subband envelope detector with programmable attack, release, and
hold time constants. Each input sample is treated as a separate
channel rather than subsequent time values. The module is applicable
to subband processing for filterbanks.
Arguments:
NAME - name of the module.
Copyright 2011. DSP Concepts, Inc. All Rights Reserved.