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 burst length in seconds (envelope decays over this window).
OptionalfilterOptional NoiseFilter applied to the noise source before the master gain. Use this to colour the noise — a lowpass on brown noise gives "explosion thump", a highpass on white gives "hi-hat tick", a bandpass gives "swoosh".
OptionalfilterFrequency multiplier applied to NoiseFilter.frequency
over duration as an exponential ramp. 1 = no sweep (default);
>1 = filter opens upward (rising swoosh, laser pew);
<1 = filter closes downward (descending thunk, explosion settle).
Has no effect when filter is unset.
OptionalgainPeak gain at attack end, 0..1. Defaults to 0.1.
OptionalpanStereo pan, -1 (full left) to 1 (full right). Defaults to 0.
OptionaltypeSpectral colour of the noise source:
"white" — flat, all frequencies equal (default)."pink" — −3 dB / octave roll-off, perceptually balanced —
classic for breath, wind, and acoustic-sounding ambient texture."brown" (red) — −6 dB / octave roll-off, low and rumbly —
classic for distant thunder, ocean, low-fi rumble.
Options for
noise.