Reference triggerAttack()

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.

Examples

Syntax

triggerAttack(note, [velocity], [secondsFromNow])

Parameters

note
String | Number:

the note you want to play, specified as a frequency in Hertz (Number) or as a midi value in Note/Octave format ("C4", "Eb3"...etc") See Tone. Defaults to 440 hz

velocity
Number:

velocity of the note to play (ranging from 0 to 1)

secondsFromNow
Number:

time from now (in seconds) at which to play

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