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
Trigger the Release of the envelope. Similar to releasing the key on a piano and letting the sound fade according to the release level and release time.
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.
Notice any errors or typos? Please let us know. Please feel free to edit src/Envelope.js and open a pull request!

Related References