earmuff-wasm

command
v0.0.0-...-685986b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: ISC Imports: 10 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL