scripts/xa-file.js + scripts/xa-fileio.js — the file-IO corner

Three automated proofs: (1) saveAudio (post-repair: delegates to the canonical io/wav.encodeWav and returns the Blob) writes a 1 s 440 Hz tone that loadFile reloads within the 16-bit quantization bound — original and reloaded waveforms are overlaid below; (2) example()/exampleBuffer() exercise the AudioCache against a local fixture (fixtures/trumpet.ogg — WAV bytes; the remote sample registry stays unverified, see barrel note) proving entries+1 after first load and a zero-network cache hit on the second; (3) fileio.stream() (post-repair docs: chunked reader, NOT streaming frame-generator semantics) splits a 3 s tone into exactly ⌈N/2048⌉ lossless blocks. Chunk math node-verified 2026-07-02 via injected decoder (65 blocks, bitwise re-concat). Saving triggers one real download of pleco-tone-440.wav — that side effect is the point.

original (blue) vs reloaded (orange, drawn on top)

cache stats



live mic RMS (manual, optional)