music · as · code

Write music in plain text.
Play it. Print it.

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.

▶ Try the playground Read the docs
No install needed — it compiles and plays right in your browser.
song.ear
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" {
        bar quarter { E5 G5 B5 (E5 + octave) }
    }
}

A composer's tools, a developer's workflow

Everything you'd want from a real toolchain — because earmuff source is just text.

📝

Readable syntax

A step grid for rhythm, named notes and chords (C#, Am7), and an escape hatch for exact timing.

🔁

Programmable

Reusable patterns, for loops over chord progressions, conditionals — all resolved at compile time, so it's deterministic.

🎛️

Full MIDI

Notes and chords alongside control change, pitch bend, aftertouch, program change, and sysex.

🎼

Sheet music

Engrave a real score to PDF or SVG via LilyPond — from the exact same source.

🎹

Hear it instantly

Play straight to a synth, or write a Standard MIDI File for any DAW.

🧩

Editor support

A VS Code extension with diagnostics, autocomplete, and a live score preview that updates as you type.

One source, three outputs

earmuff parses and analyzes your piece, expands it into a precise event stream, then renders it however you need.

song.ear
your source
elaborate
parse · analyze · expand
🎹 MIDI & playback
🎼 sheet music
📄 LilyPond

Start composing in text

Free and open source. Written in Go.