Feature Library

Audio engine for shows

0.05 CPU ms
A still of the Audio engine for shows demo
Still
The live demo starts when it’s in view.Click once to start sound · pick a bed, fire cues, play the sequence · faders take arrows, Page Up and Down, Home and End

Sound for a live show or an app, with Web Audio only.

What it costs a frame

0.05 ms
GPU
not used
CPU, median
0.05 ms
CPU, 95th pct
0.11 ms
Draw calls
0
Weight
Light

Measured 7 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 156, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured with the demo exercising itself: the 32-second sequence plays on a loop (beds crossfading, cues, ducking, a chased loop) and a fader moves every 30 frames. The bench run has no click, so the browser keeps audio locked: the engine runs its silent model on the same schedule, and what is timed is the main thread (the scheduler waking every half second, the demo’s own readouts, the mixer’s writes). Mixing runs on the audio thread, outside the frame; meters read nothing while silent. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring toolnot timed0.050.11
apple · Apple A19 Proin a browser tab · 16 November 2026not timed0.020.10
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026not timed0.040.10

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
DOM and CSSPlain DOM and CSS: every current browser.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Live stage presentations and kiosks
  2. Music and narration under a walkthrough
  3. Games and interactive stories
  4. Background music in an app, with a mixer in its settings
  5. Sound cues synchronised with animation
  6. Prototyping sound before the recordings exist

Pitfalls, in brief

  1. Browsers start audio only after a click, a tap or a key press on the page.
  2. Preload a segment before its moment: play() of a sound that is not decoded yet returns null and warns, rather than playing late. preload() returns a hold; release() it when the segment is over and its buffers go once nothing plays them.
  3. Decoded audio is big: 32-bit floats per sample per channel, about 23 MB a minute in stereo at 48 kHz, whatever the file size was. memory() says what is held; set budget to be warned.
  4. MP3 files carry silence at their start and end from the encoder, so an MP3 never loops without a gap.
  5. A loop seams cleanly only if its two ends meet: make music beds a whole number of bars, and fold any release or reverb tail back onto the start (the synth helpers do).
6 more in brief
  1. Drive visuals from engine.timeline.time, not from your own timer: audio cannot be nudged without a click, visuals can, so the sound is the master clock.
  2. Timeline cues are handed to Web Audio up to one second ahead (lookahead).
  3. The limiter is a DynamicsCompressorNode set hard (ratio 20, no knee, 2 ms attack).
  4. After idle seconds with nothing playing the AudioContext is suspended, so the audio thread and the device rest; the next sound wakes it within a few milliseconds.
  5. One AudioContext per page: browsers limit them, and two contexts drift apart.
  6. While the page is hidden (a background tab, a minimised window) the engine suspends the AudioContext, everything on it included, and resumes it when the page shows; loops pick up where they would be, one-shots in the gap are dropped.
11 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

Written for the library. Fully custom code.

Web Audio API (W3C): sample-accurate start and stop, AudioParam automation, AudioBufferSourceNode loop points, and the DynamicsCompressorNode’s make-up gain, which the limiter undoes

Chris Wilson, “A Tale of Two Clocks” (2013): the look-ahead scheduler: a coarse timer hands events to the audio clock a little ahead of time. Written here from the idea, waking only when a cue is near

WAI-ARIA Authoring Practices Guide (W3C): the slider pattern, vertical, for the faders; written here from scratch

George Marsaglia, “Xorshift RNGs” (2003): the xorshift32 generator behind the stand-in sounds’ noise and variation

Julius O. Smith III, Introduction to Digital Filters: the two-pole resonator that shapes the whoosh and the speech-like line

web audiomusiccrossfadeseamless loopduckinglimitermixermetersschedulingshow clockautoplaypage visibilitypreloadsynthesisdeterministicaccessibilitykeyboardtouchrtldomno dependencies

Near it in the frame