signal/envelope
src/signal/envelope.tur
defstruct
ADSRParams
(defstruct ADSRParams :copy [attack :float decay :float sustain :float release :float])
parameters for an ADSR envelope.
defn
adsr-fixed
(adsr-fixed [params : ADSRParams gate-duration :float])
piecewise-linear ADSR computed analytically for a single note.
Parameters
| params | ADSRParams controlling shape | |
| gate-duration | how long the gate stays on in seconds (float64) |
Returns
A Signal Function: sig -> (fn [t] envelope-value).
Example
((adsr-fixed (make-struct ADSRParams 0.01 0.1 0.7 0.3) 0.5) (constant 0.0))
defn
adsr-gen
(adsr-gen [params : ADSRParams])
one-shot ADSR with a unit (1.0s) gate duration.
Parameters
| params | ADSRParams controlling envelope shape |
Returns
A Signal Function returning the ADSR amplitude at time t.
Example
((adsr-gen (make-struct ADSRParams 0.01 0.1 0.7 0.2)) (constant 0.0))
Internal definitions
__adsr_fixed_sample-- compute ADSR envelope value at time t.