Documentation
¶
Overview ¶
Command earmuff-wasm compiles the earmuff toolchain to WebAssembly for the in-browser playground. It exposes a single global function, earmuffCompile(source) string, that runs the same pipeline as the CLI (parse -> analyze -> elaborate -> MIDI / LilyPond) and returns a JSON string.
The JSON shape is the contract with the playground front end:
{
"ok": bool, // false if parse/elaborate failed
"diagnostics": [ {line, column, severity, message}, ... ],
"project": "name", // first project, "" if none
"trackCount": int,
"eventCount": int,
"bpm": float,
"timeBeats": int,
"timeUnit": int,
"durationTicks": int, // last event tick
"ppq": 960,
"tracks": [ {name, instrument, channel, program}, ... ],
"events": [ {t, track, kind, ch, key, vel, ctrl, val, prog, bend, text}, ... ],
"midiBase64": "....", // Standard MIDI File bytes
"lilypond": "...." // LilyPond source for the score
}
Build: GOOS=js GOARCH=wasm go build -o earmuff.wasm ./cmd/earmuff-wasm
Click to show internal directories.
Click to hide internal directories.