tur/envelope
stdlib/envelope.tur
defstruct
ADSRParams
(defstruct ADSRParams [attack :int decay :int sustain :int release :int])
parameters for an ADSR envelope.
defn
adsr-fixed
(adsr-fixed [params gate-duration])
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) |
Example
A Signal Function: sig -> (fn [t] envelope-value). ((adsr-fixed (ADSRParams 0.01 0.1 0.7 0.3) 0.5) (constant ()))
Internal definitions
__adsr_attack-- extract attack field from ADSRParams struct pointer.__adsr_decay-- extract decay field from ADSRParams struct pointer.__adsr_sustain-- extract sustain field from ADSRParams struct pointer.__adsr_release-- extract release field from ADSRParams struct pointer.__adsr_fixed_sample-- compute ADSR envelope value at time t.