gtadsr
A gated linear attack-decay-sustain with exponential release.
This opcode can generate an envelope or apply it to an audio signal. A positive kgate starts attack and decay, then holds the sustain level. A zero or negative gate starts release. Attack and decay durations are captured when the gate becomes positive.
Syntax
Performance
x/ares -- output signal (k or a-rate)
asig -- input signal (envelope as an amplitude processor)
kamp -- maximum amplitude (envelope as a signal generator)
katt -- attack duration in seconds; must be nonnegative.
kdec -- decay duration in seconds; must be nonnegative.
ksus -- level for sustain phase (in the range 0 - 1)
krel -- release time in seconds for a 60 dB drop in envelope level. Zero or negative values end release immediately.
kgate -- gate signal (zero or negative = low, positive = high).
Attack reaches the peak envelope level before decay begins, and decay reaches ksus. Zero or very short attack and decay times each take at least one output sample at audio rate, or one control period at control rate. If the gate becomes positive during release, a new attack starts from the current level and lasts for the newly captured attack duration.
Sustain lasts while the gate stays positive; it is not calculated from the score note's duration. For MIDI use, drive the gate from the note state and keep the instrument running long enough for release.
Examples
Here is an example of the gtadsr opcode. It uses the file gtadsr.csd.
See Also
Credits
Author: Victor Lazzarini;
New in version 6.17