Audio engine · 2026-09-23
Playing MIDI in the browser without a plugin
How Soundfish plays compositions in the browser: a pinned MuseScore General bank, a patched SpessaSynth AudioWorklet, device-aware voice budgets, and release-hashed sound assets.
One bank, pinned
Playback uses a single fixed sound release: the MuseScore General 0.2.0 bank, vendored same-origin with its license and provenance tracked, plus drum kits built from pinned sources with generated credits. Every instrument a composition names maps to an exact program in that release — there is no third-party runtime dependency and no silent sound drift between visits.
The release is hashed into the page itself (data-sound-release), so a change to any playback implementation or bank rolls the identity. Clients, tests, and agents can tell which sound a document was heard under.
A worklet, not a main thread
Synthesis runs in a patched SpessaSynth AudioWorklet processor off the main thread, driven by a scheduler that owns the transport clock. The player publishes real audio, not note events — the live spectrum lane reads an analyser tap on a separate read-only branch while the stereo output goes straight to its destination.
Mobile playback deliberately stays on the audio element's native path: handheld platforms suspend AudioContext on lock, so the engine does not fight the device for the channel.
Device budgets on purpose
Sound is expensive enough to deserve policy. The bank defers preloading on metered connections and saveData, voice caps follow the device class rather than the score's ambitions, and speculative loading fails closed when the client refuses to say what it is. A composition that fits in a link should not punish the phone that opens it.
Where files and imports fit
Export goes the other direction too: Standard MIDI keeps tempo, tracks, instruments, notes, velocities, and section markers for other software, and reviewed local imports can transcribe authorized audio into loop and song documents through the pinned Basic Pitch graph — a local, permissioned path for turning recordings into editable music, never an upload-your-catalog feature.
The short version
A fixed bank, a worklet, and honest device budgets are what let a link open into music on hardware you do not control.