← Gallery Audio I/O — synthesize, analyze, play

Audio I/O — synthesize, analyze, play

scripts/xa-audioio.js

Build sound from scratch: a pure 440 Hz tone and a sweep that glides from 200 Hz up to 2000 Hz, generated, measured, and played entirely in your browser. The waveform below is the sweep; press Play to hear it routed through the library's own playback path. Verification: tone(440) at sr=8000 for 0.5 s must contain exactly 2·440·0.5 = 440 zero crossings, the 200→2000 Hz chirp(), split into quarters, must show a strictly increasing zero-crossing count (frequency-ramp proof), and muExpand(muCompress(x)) must round-trip to maxErr < 1e-6 (numeric halves node-verified 2026-07-02: ZC=440, mu err 1.2e-7). The Play button routes the chirp through the module's own load()/play() Web Audio path — the half Node can't prove.