Summary

Modify a signal with a DAHDSR (Delay Attack Hold Decay Sustain Release) envelope.

Audio Connections

PortPurpose
In 0Signal Input
Out 0Signal with Envelope Applied

Functions

noteOn();

Begin the delay to attack, or the attack phase is delay is zero.

noteOff();

Begin the release phase.

delay(milliseconds);

Set the delay from noteOn to the attach phase. The default is zero, for no delay.

attack(milliseconds);

Set the attack time. The default is 1.5 milliseconds.

hold(milliseconds);

Set the hold time. The default is 0.5 milliseconds.

decay(milliseconds);

Set the decay time. The default is 15 milliseconds.

sustain(level);

Set the sustain level. The range is 0 to 1.0. The gain will be maintained at this level after the decay phase, until noteOff() is called.

release(milliseconds);

Set the release time. The default is 30 millisecond.

Examples

File > Examples > Audio > Synthesis > PlaySynthMusic

File > Examples > Audio > Synthesis > pulseWidth

File > Examples > Audio > MemoryAndCpuUsage

Notes

To achieve the more common ADSR shape, simply set delay and hold to zero.

The recommended range for each of the 5 timing inputs is 0 to 50 milliseconds. Up to 200 ms can be used, with somewhat reduced accuracy