adsr

Files: adsr.h, adsr.c

ADSR generator This is an ADSR generator whose curves are created using a one-pole low pass filter.
NOTE: The attack, decay, and release parameters are "fuzzy" values that don't exactly correspond to duration in seconds. More accurately, they are special tau constant units that feed into the filter used to generate the envelope. The attack value specificly undergoes some "creative" modificiations in order to create snappier attack times. It is highly recommend to tune parameters by ear rather than to read the values literally.

Functions

sp_adsr_create(sp_adsr **adsr)
sp_adsr_init(sp_data *sp, sp_adsr *adsr)
sp_adsr_compute(sp_data *sp, sp_adsr *adsr, SPFLOAT *gate, SPFLOAT *out)
sp_adsr_destroy(sp_adsr **adsr)

Optional Parameters

atk: Attack
(Default value: 0.1)
dec: Decay
(Default value: 0.1)
sus: Sustain (in range 0-1)
(Default value: 0.5)
rel: Release
(Default value: 0.3)

Inputs

gate: Gate signal. This should be a steady state signal that jumps from 0 to 1.

Outputs

out: ADSR envelope.