Reference noteADSR()

noteADSR()

noteADSR sets the envelope for a specific note that has just been triggered. Using this method modifies the envelope of whichever audiovoice is being used to play the desired note. The envelope should be reset before noteRelease is called in order to prevent the modified envelope from being used on other notes.

Syntax

noteADSR([note], [attackTime], [decayTime], [susRatio], [releaseTime])

Parameters

note
Number:

Midi note on which ADSR should be set.

attackTime
Number:

Time (in seconds before envelope reaches Attack Level

decayTime
Number:

Time (in seconds) before envelope reaches Decay/Sustain Level

susRatio
Number:

Ratio between attackLevel and releaseLevel, on a scale from 0 to 1, where 1.0 = attackLevel, 0.0 = releaseLevel. The susRatio determines the decayLevel and the level at which the sustain portion of the envelope will sustain. For example, if attackLevel is 0.4, releaseLevel is 0, and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is increased to 1.0 (using setRange), then decayLevel would increase proportionally, to become 0.5.

releaseTime
Number:

Time in seconds from now (defaults to 0)

Notice any errors or typos? Please let us know. Please feel free to edit lib/addons/p5.sound.js and open a pull request!

Related References