gtadsr

gtadsr — A gated linear attack-decay-sustain with exponential release.

Description

This opcode can work either as a signal generator or as a signal processor. It is controlled by a gate k-rate signal (0 or > 0) which switches the envelope attack-decay-sustain phase on/off. With gate > 0 (high), the envelope cycles through the attack and decay phases, and is sustained at the sustain level. Whenever gate is 0 (low), the envelope enters the release phase, decaying exponentially to 0. The attack and decay times are fixed with gate > 0, but can be changed once the gate is zero.

Syntax

ares gtadsr asig, katt, kdec, ksus,
    krel, kgate
xres gtadsr kamp, katt, kdec, ksus,
    krel, kgate

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 -- duration of attack phase

kdec -- duration of decay

ksus -- level for sustain phase (in the range 0 - 1)

krel -- duration of release phase

kgate -- gate signal (0 = low, > 0 high).

The length of the sustain is calculated from the length of the note. This means gtadsr is not suitable for use with MIDI events.

Examples

Here is an example of the gtadsr opcode. It uses the file gtadsr.csd.

Example 406. Example of the gtadsr opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>

0dbfs = 1

instr 1
 gkamp = p4
 gkfr = p5
 gkgate = 1
 gkatt = p6
 gkdec = p7
 gksus = p8
 gkrel = p9
endin

instr 2
 a1 oscili gkamp,gkfr
 a2 gtadsr  a1,gkatt,gkdec,gksus,gkrel,gkgate
 out a2
 gkgate = 0;
endin

</CsInstruments>
<CsScore>
i1 0 1 1 440 0.1 0.1 0.5 0.1
i1 1.2 1 1 660 0.01 0.1 0.2 0.3
i1 2.5 1 1 550 0.01 0.1 0.7 1
i2 0 5
</CsScore>
</CsoundSynthesizer>


See Also

adsr, madsr, xadsr

Credits

Author: Victor Lazzarini;

New in version 6.17