pink.envelopes

Envelope Generator Functions

adsr

(adsr a d s r)
Attack-Decay-Sustain-Release Envelope. If *done* boolean array flag is used,
will await until done is set to true before performing release stage.  Otherwise, 
defaults to *duration* or 1.0 for total time of envelope.

Based on code by Nigel Redmon at http://www.earlevel.com/main/2013/06/03/envelope-generators-adsr-code/

adsr140

(adsr140 gatefn retrigger attack decay sustain release)
ADSR Envelope generator based on Doepfer A-140. Takes in gate audio
function, as well as retrigger audio function (pass in 0 if not using
retrigger). 

Based on code by Nigel Redmon at
http://www.earlevel.com/main/2013/06/03/envelope-generators-adsr-code/

env

(env pts)
Generates an envelope given pairs of values (t0, v0, t1, v1 ...) where tx is duration of segment.

exp-env

(exp-env pts)
Generates an exponential envelope given pairs of values (t0, v0, t1, v1 ...) where tx is duration of segment.

get-line-pt

(get-line-pt sample linedata)

hold

(hold value duration)
Simple envelope that holds a given value for a given
duration.  Will zero out after duration if duration ends
mid-buffer, then return nil afterwards to signal
completion.

transeg

(transeg [start & segments])
Line segment generator using formula for each segment:

ibeg +  (ivalue - ibeg) * (1 - exp( i*itype/(n-1) )) / 
    (1 - exp(itype))

for n steps. Points are given in format of:

ia, idur, itype, ib, idur2, itype2, ic...

where i_ is a value, dur is time in seconds, and itype affects the curve of the segment (0 = straight line, < 0 = conve, > 0 = concave))

xar

(xar a r)
Exponential Attack-Release Envelope