Development
Build, test, benchmark, and preview the docs locally.
The repository is an npm workspace:
| Path | What it is |
|---|---|
packages/sfx | The published library: src/, tests, benchmark, and size budget |
apps/docs | This site: Next.js, Fumadocs, and a static export for GitHub Pages |
Requires Node.js 24 or later.
npm install
npm test # build and run the test suite
npm run coverage # tests with a 100% line, branch, and function gate
npm run bench # play() cost, live synthesis vs. pre-rendered buffers
npm run size # bundle size budget (gzip)
npm run dev # this site at http://localhost:3903 (or bun dev)Tests
test/engine.test.tsdrives the engine against a recording fake of the Web Audio API: gating, the master bus, rendering, voices, suspended contexts, and cleanup.test/bind.test.tsuses happy-dom for attributes, hover rules, keyboard support, disabled controls, and multiple roots.test/render.test.tsrenders every recipe with a real Web Audio implementation and checks the audio: finite, audible, below full scale, decaying to silence, mono or stereo as designed, and at the right pitch.test/recipes.test.tschecks the catalog, levels, and ring-out times.
Changing a sound
- Edit its recipe in
packages/sfx/src/recipes.ts. - Run
npm run docs:devand listen on the sound board. - Run
npm test. The render tests catch clipping, silence, and tails that don't decay.
Previewing the production site
NEXT_PUBLIC_BASE_PATH=/sfx npm run docs:build
NEXT_PUBLIC_BASE_PATH=/sfx npm run docs:preview