Orientation for agents working in this repo (a WebAssembly music + visuals app). Humans: see README.md and wasmaudioworklet/docs.
wasmaudioworklet/— the app (synth engine, sequencer, visualizer, web UI).wasmaudioworklet/docs/— authoring & dev guides (start at its README).tools/— dev tooling:faust2as(Faust→AssemblyScript),claude-bridge(connect an agent to the app's editors),shadertest(shader harness),faust-compiler-module(build/validate/publish the Faust compiler wasm).- Songs/visuals are usually authored in separate NEAR-backed git repos loaded
via
?gitrepo=(see git-hosting); a song project holdssong.js,synth.ts,shaders/,images/andwasmmusic.config.json.
You can't see the canvas or hear the audio, so lean on the headless checks:
- Faust instruments: render one headlessly and measure it with
tools/instrumenttest/render.mjs— it transpiles the.dsp, compiles it into the real midisynth, sends actual MIDI notes to the wasm and reports peak/RMS and spectrum per note (exit 1 if anything is silent):cd wasmaudioworklet && node ../tools/instrumenttest/render.mjs faust/kick.dsp --notes c3,fs3. This is the only check that catches the worst Faust mistake — an instrument that transpiles, registers and compiles perfectly and makes no sound (usually a missinggate). It also answers whether notes map to different drums: same spectrum for every note means there is no mapping. To compare two instruments — a port against its original, a redesign against the previous version — usetools/instrumenttest/compare.mjs a.dsp b.ts:5: level, pitch (YIN), centroid and decay per note, averaged over many hits through one instance. A single hit of a noise-excited instrument can mislead by 3×; for a sample-exact check drive both with the same deterministic exciter. - Visualizer shaders: compile + render frames headlessly with
tools/shadertest/render.mjs— see docs/shaders.md. Always compile-check after an edit; render frames at a few times/energies and read the PNGs before claiming a shader works. - Songs (
song.js): compiling a song yields a MIDI event list — the ground truth for what it actually plays, and checkable without hearing it. Whether two instruments play together is a fact there: compile and compare note ranges per channel (the studio agent gets this assong_summary; seesummarizeSongEventsinwasmaudioworklet/studio-agent/tools-core.js). It's ESM with top-levelawait, so a quicknode --checkcatches syntax errors before loading in the app. Timing follows one model — calling a pattern schedules it at the playhead,awaitis the only thing that moves the playhead — so parts that sound together are plain calls and only the beat-keeper is awaited. Read the playhead model before editing a song; the layering,loopHere()and wrapper-function rules are all consequences of it. - Faust / AssemblyScript / near-git: Playwright suites under
wasmaudioworklet/e2e(npm run test-faust,test-near-git, etc.). New specs should take their own repo:?gitrepo=${specRepo('my-feature')}gives an isolated local OPFS repo — a name the sandbox can't clone falls back to a persistent local one, and everything needing?gitrepo=mode (faust/, the agent's OPFS tools, git history) still works. The shared sandbox repo is mutated by every spec that uses it, and since CI retries failed tests, a half-finished attempt can strand state that breaks an unrelated spec later in the run. Use the shared repo only to exercise the real remote (clone, commit & sync, push).
- AssemblyScript synth code:
--runtime stub(no GC),StaticArray,f32audio,Mathf.*, sample-by-samplenextframe(). - Don't commit or push unless asked. If on the default branch, branch first.