Reference p5.Envelope

p5.Envelope

Generate an amplitude envelope.

Examples

Syntax

p5.Envelope([attack], [decay], [sustain], [release])

Parameters

attack
Number: how quickly the envelope reaches the maximum level
decay
Number: how quickly the envelope reaches the sustain level
sustain
Number: how long the envelope stays at the decay level
release
Number: how quickly the envelope fades out after the sustain level

Methods

play
Trigger the envelope and release it after the sustain time.
triggerAttack
Trigger the Attack, and Decay portion of the Envelope. Similar to holding down a key on a piano, but it will hold the sustain level until you let go.
triggerRelease
Triggers the "release" of an envelope. Akin to letting go of a key on the piano after striking its.
setADSR
Sets the attack, decay, sustain, and release times of the envelope.
releaseTime
Sets the release time of the envelope.
attackTime
Sets the attack time of the envelope.

Related References