OptionalattackAttack time in seconds — linear ramp from 0 up to gain. Clamped
to [0.001, duration / 2]. For very short durations (< 2 ms) the
upper bound wins so the envelope still fits inside the playback
window. Defaults to 0.005.
OptionaldelaySeconds to wait before the sound starts, scheduled on the audio
clock rather than a timer. 0 (the default) plays immediately.
This is what sequences a multi-part sound — a stinger's second
note, an explosion's double-tap — and it is sample-accurate, which
setTimeout is not: a timer fires on the main thread, so a busy
frame slips the note audibly. Nothing is allocated until the sound
actually starts.
Total sound length in seconds (envelope decays over this window).
Carrier frequency in Hz. Pass an array to layer multiple partials (chord, bell ring, fundamental + harmonic) — they share the gain envelope, pan, and pitch slide.
OptionalgainPeak gain at attack end, 0..1. Defaults to 0.1.
OptionalpanStereo pan, -1 (full left) to 1 (full right). Defaults to 0.
OptionalpitchFrequency multiplier applied over duration as an exponential
ramp. 1 = no slide (default); 0.5 = slide an octave down;
2 = slide an octave up. Useful for percussive impacts (small
value < 1) or rising stings (value > 1).
OptionalwaveOscillator waveform. Defaults to "sine".
Options for
tone.