earmuff is a language for composing music as source code — so you get git, diffs, review, and scripting for free. Compile to MIDI, play it live, or engrave real sheet music.
project "demo" { bpm 96; time 4 4; track "piano" instrument "piano" { let changes = [Cmaj7, Am7, Dm7, G7]; for ch in changes { bar quarter { ch ch ch ch } } } track "lead" instrument "violin" { // a caret carries a note's octave: E^5 is E in octave 5 bar quarter { E^5 G^5 B^5 (E^5 + octave) } } }
Everything you'd want from a real toolchain — because earmuff source is just text.
A step grid for rhythm, named notes and chords (C#, Am7), and an escape hatch for exact timing.
Reusable patterns, for loops over chord progressions, conditionals — all resolved at compile time, so it's deterministic.
Notes and chords alongside control change, pitch bend, aftertouch, program change, and sysex.
Engrave a real score to PDF or SVG via LilyPond — from the exact same source.
Play straight to a synth, or write a Standard MIDI File for any DAW.
A VS Code extension with diagnostics, autocomplete, and a live score preview that updates as you type.
earmuff parses and analyzes your piece, expands it into a precise event stream, then renders it however you need.
Bring tunes in, too: earmuff -import song.mid turns a Standard
MIDI File back into editable .ear source — or drop a
.mid (or .ear) right onto the playground. And
every piece exports to a Standard MIDI File with -out.
Write music as code, hear it, and watch it engrave — in your editor or right in the browser.
.mid or .ear by dropping it on the page.
Free and open source. Written in Go.