<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>earmuff</title><link>https://earmuff.io/docs/</link><description>Recent content on earmuff</description><generator>Hugo</generator><language>en</language><atom:link href="https://earmuff.io/docs/index.xml" rel="self" type="application/rss+xml"/><item><title>Bars and the step grid</title><link>https://earmuff.io/docs/docs/language/bars-and-the-step-grid/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/language/bars-and-the-step-grid/</guid><description>&lt;h1 id="bars-and-the-step-grid"&gt;Bars and the step grid&lt;a class="anchor" href="#bars-and-the-step-grid"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;A &lt;code&gt;bar&lt;/code&gt; lays events on a grid. The grid&amp;rsquo;s step is the bar&amp;rsquo;s duration, and the
cursor advances exactly &lt;strong&gt;one step per token&lt;/strong&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bar quarter { C E G _ } // four quarter-note slots
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bar 8 { C C C C C C C C } // an eighth-note grid: eight slots&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A duration can be a word (&lt;code&gt;whole&lt;/code&gt;, &lt;code&gt;half&lt;/code&gt;, &lt;code&gt;quarter&lt;/code&gt;) or a number (&lt;code&gt;1&lt;/code&gt;, &lt;code&gt;2&lt;/code&gt;,
&lt;code&gt;4&lt;/code&gt;, &lt;code&gt;8&lt;/code&gt;, &lt;code&gt;16&lt;/code&gt;, &lt;code&gt;32&lt;/code&gt;, &lt;code&gt;64&lt;/code&gt;, &lt;code&gt;128&lt;/code&gt;), with the suffix &lt;code&gt;.&lt;/code&gt; for dotted (×1.5) and
&lt;code&gt;t&lt;/code&gt; for triplet (×2/3).&lt;/p&gt;</description></item><item><title>Introduction</title><link>https://earmuff.io/docs/docs/introduction/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/introduction/</guid><description>&lt;h1 id="introduction"&gt;Introduction&lt;a class="anchor" href="#introduction"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;earmuff&lt;/strong&gt; is a small language for describing music in plain text. You write a
&lt;em&gt;project&lt;/em&gt; made of &lt;em&gt;tracks&lt;/em&gt; and &lt;em&gt;bars&lt;/em&gt;; earmuff parses and analyzes the source,
then turns it into a Standard MIDI File, live playback through a synth, or
engraved sheet music.&lt;/p&gt;
&lt;h2 id="why-text"&gt;Why text&lt;a class="anchor" href="#why-text"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Music in earmuff is just source code, so the tools you already use apply to it
directly:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Diffable&lt;/strong&gt; — a change to a phrase is a line in a diff, not an opaque binary.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reviewable&lt;/strong&gt; — pull requests, comments, and blame work on a song.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scriptable&lt;/strong&gt; — generate progressions, transpose, or template arrangements
with ordinary code, then compile the result.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Everything in earmuff is resolved at compile time, so a given source always
produces the same output — the music is deterministic.&lt;/p&gt;</description></item><item><title>Install</title><link>https://earmuff.io/docs/docs/install/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/install/</guid><description>&lt;h1 id="install"&gt;Install&lt;a class="anchor" href="#install"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;earmuff is written in &lt;a href="https://go.dev"&gt;Go&lt;/a&gt; and requires Go 1.18+.&lt;/p&gt;
&lt;h2 id="binaries"&gt;Binaries&lt;a class="anchor" href="#binaries"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are two binaries. Install the compiler/player:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go install github.com/poolpOrg/earmuff/cmd/earmuff@latest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And, for editor support, the language server:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go install github.com/poolpOrg/earmuff/cmd/earmuff-lsp@latest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both land in &lt;code&gt;$(go env GOPATH)/bin&lt;/code&gt;; make sure that directory is on your
&lt;code&gt;PATH&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="optional-dependencies"&gt;Optional dependencies&lt;a class="anchor" href="#optional-dependencies"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;These are only needed for the corresponding features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Playback&lt;/strong&gt; — a MIDI synth. earmuff auto-detects one (&lt;code&gt;timidity&lt;/code&gt; on Linux,
&lt;code&gt;fluidsynth&lt;/code&gt; with a SoundFont, etc.). See
&lt;a href="https://earmuff.io/docs/docs/command-line/"&gt;Command line → Playback&lt;/a&gt; for the
resolution order and the macOS note.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sheet music&lt;/strong&gt; — &lt;a href="https://lilypond.org"&gt;LilyPond&lt;/a&gt; on your &lt;code&gt;PATH&lt;/code&gt;, used by
the &lt;code&gt;-pdf&lt;/code&gt;/&lt;code&gt;-svg&lt;/code&gt;/&lt;code&gt;-ly&lt;/code&gt; flags. See
&lt;a href="https://earmuff.io/docs/docs/sheet-music/"&gt;Sheet music&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="verify-it-works"&gt;Verify it works&lt;a class="anchor" href="#verify-it-works"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Compile and play one of the bundled examples:&lt;/p&gt;</description></item><item><title>Notes and chords</title><link>https://earmuff.io/docs/docs/language/notes-and-chords/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/language/notes-and-chords/</guid><description>&lt;h1 id="notes-and-chords"&gt;Notes and chords&lt;a class="anchor" href="#notes-and-chords"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Notes and chords are written by name, directly in musical position — the
&lt;code&gt;note&lt;/code&gt;/&lt;code&gt;chord&lt;/code&gt; keywords are optional.&lt;/p&gt;
&lt;h2 id="notes"&gt;Notes&lt;a class="anchor" href="#notes"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A note is a letter &lt;code&gt;A&lt;/code&gt;–&lt;code&gt;G&lt;/code&gt;, an optional accidental (&lt;code&gt;#&lt;/code&gt; or &lt;code&gt;b&lt;/code&gt;), and an optional
octave number:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C C# Eb F#3 Cb&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Without an octave, a default register is used; an explicit number (&lt;code&gt;C5&lt;/code&gt;, &lt;code&gt;F#3&lt;/code&gt;,
&lt;code&gt;E2&lt;/code&gt;) pins the octave.&lt;/p&gt;
&lt;h2 id="chords"&gt;Chords&lt;a class="anchor" href="#chords"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Chords are written by name:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Am7 Gmaj7 C7 Dm7b5 C7/E&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Slash chords (&lt;code&gt;C7/E&lt;/code&gt;) specify the bass note.&lt;/p&gt;</description></item><item><title>Patterns and control flow</title><link>https://earmuff.io/docs/docs/language/patterns-and-control-flow/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/language/patterns-and-control-flow/</guid><description>&lt;h1 id="patterns-and-control-flow"&gt;Patterns and control flow&lt;a class="anchor" href="#patterns-and-control-flow"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Patterns and control flow are evaluated at &lt;strong&gt;compile time&lt;/strong&gt;. There is no runtime
branching: &lt;code&gt;for&lt;/code&gt;, &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt;, and pattern calls all run during elaboration over
compile-time-known values, so the event stream is fully determined before any
MIDI is emitted. Loops are bounded and bindings are immutable, which guarantees
termination and keeps the music deterministic and diffable.&lt;/p&gt;
&lt;h2 id="patterns"&gt;Patterns&lt;a class="anchor" href="#patterns"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A &lt;code&gt;pattern&lt;/code&gt; is a named, reusable block. It can take parameters and is invoked
with a call:&lt;/p&gt;</description></item><item><title>MIDI and dynamics</title><link>https://earmuff.io/docs/docs/language/midi-and-dynamics/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/language/midi-and-dynamics/</guid><description>&lt;h1 id="midi-and-dynamics"&gt;MIDI and dynamics&lt;a class="anchor" href="#midi-and-dynamics"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;earmuff exposes the full MIDI set as first-class statements, alongside notes and
chords.&lt;/p&gt;
&lt;h2 id="raw-events"&gt;Raw events&lt;a class="anchor" href="#raw-events"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;program &amp;#34;violin&amp;#34;; // program change (by name or number)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cc 74 = 64; // control change
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;bend +2; // pitch bend, in semitones
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pressure 90; // channel aftertouch
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sysex F0 7E 7F 09 01 F7; // raw system-exclusive bytes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;These can sit in a step slot or be placed with &lt;code&gt;on beat&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="bend"&gt;Bend&lt;a class="anchor" href="#bend"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;bend&lt;/code&gt; is expressed in &lt;strong&gt;semitones&lt;/strong&gt;. &lt;code&gt;bend +2&lt;/code&gt; bends two semitones up; the
elaborator emits the RPN pitch-bend-range message once per track so the result
is correct regardless of the synth&amp;rsquo;s default range, then the 14-bit value for
the requested offset. Escape hatches:&lt;/p&gt;</description></item><item><title>Command line</title><link>https://earmuff.io/docs/docs/command-line/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/command-line/</guid><description>&lt;h1 id="command-line"&gt;Command line&lt;a class="anchor" href="#command-line"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;earmuff [flags] source.ear&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;Flag&lt;/th&gt;
 &lt;th&gt;Description&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;-out file.mid&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;write a Standard MIDI File&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;-pdf file.pdf&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;engrave sheet music as PDF (needs lilypond)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;-svg file.svg&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;engrave sheet music as SVG (needs lilypond)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;-ly file.ly&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;write the intermediate LilyPond source&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;-player &amp;lt;cmd&amp;gt;&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;player command template, &lt;code&gt;{}&lt;/code&gt; = the MIDI file&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;-lilypond &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;path to the lilypond binary (for &lt;code&gt;-pdf&lt;/code&gt;/&lt;code&gt;-svg&lt;/code&gt;)&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;-quiet&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;suppress the summary and skip playback&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;-verbose&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;dump the elaborated event stream&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;With no &lt;code&gt;-out&lt;/code&gt;/&lt;code&gt;-pdf&lt;/code&gt;/&lt;code&gt;-svg&lt;/code&gt; and without &lt;code&gt;-quiet&lt;/code&gt;, earmuff &lt;strong&gt;plays&lt;/strong&gt; the piece.&lt;/p&gt;</description></item><item><title>Sheet music</title><link>https://earmuff.io/docs/docs/sheet-music/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/sheet-music/</guid><description>&lt;h1 id="sheet-music"&gt;Sheet music&lt;a class="anchor" href="#sheet-music"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;earmuff can engrave a score from the same source it plays. It emits
&lt;a href="https://lilypond.org"&gt;LilyPond&lt;/a&gt; and lets LilyPond do the engraving.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;earmuff -pdf song.pdf song.ear &lt;span class="c1"&gt;# engrave a PDF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;earmuff -svg song.svg song.ear &lt;span class="c1"&gt;# engrave an SVG&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;earmuff -ly song.ly song.ear &lt;span class="c1"&gt;# write the intermediate LilyPond source&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="lilypond-requirement"&gt;LilyPond requirement&lt;a class="anchor" href="#lilypond-requirement"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;-pdf&lt;/code&gt; and &lt;code&gt;-svg&lt;/code&gt; require &lt;a href="https://lilypond.org"&gt;LilyPond&lt;/a&gt; on your &lt;code&gt;PATH&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;brew install lilypond &lt;span class="c1"&gt;# macOS; use your package manager elsewhere&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If LilyPond is installed somewhere unusual, point &lt;code&gt;-lilypond&lt;/code&gt; at the binary.
&lt;code&gt;-ly&lt;/code&gt; writes only the LilyPond source and needs no LilyPond installed, which is
useful for inspecting or hand-tweaking the output.&lt;/p&gt;</description></item><item><title>Editor support</title><link>https://earmuff.io/docs/docs/editor-support/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/editor-support/</guid><description>&lt;h1 id="editor-support"&gt;Editor support&lt;a class="anchor" href="#editor-support"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="language-server"&gt;Language server&lt;a class="anchor" href="#language-server"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;earmuff-lsp&lt;/code&gt; is a language server that works in any LSP-capable editor. It
provides:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;live &lt;strong&gt;diagnostics&lt;/strong&gt; (from earmuff&amp;rsquo;s own parser and analyzer, so they match
the compiler exactly);&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;completion&lt;/strong&gt;;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;hover&lt;/strong&gt;;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;go-to-definition&lt;/strong&gt;;&lt;/li&gt;
&lt;li&gt;a document-symbol &lt;strong&gt;outline&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Install it with:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;go install github.com/poolpOrg/earmuff/cmd/earmuff-lsp@latest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="vs-code-extension"&gt;VS Code extension&lt;a class="anchor" href="#vs-code-extension"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The VS Code extension bundles the language server and adds:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;syntax highlighting&lt;/strong&gt; for &lt;code&gt;.ear&lt;/code&gt; files (keywords, note/chord literals,
durations, dynamics, strings, comments, operators);&lt;/li&gt;
&lt;li&gt;a &lt;strong&gt;live sheet-music preview&lt;/strong&gt; that re-renders automatically (debounced) as
you type, engraving the unsaved buffer with LilyPond;&lt;/li&gt;
&lt;li&gt;commands (from the Command Palette or the editor&amp;rsquo;s title-bar buttons):
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;earmuff: Compile to MIDI&lt;/strong&gt; — writes &lt;code&gt;&amp;lt;file&amp;gt;.mid&lt;/code&gt; next to the source;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;earmuff: Play&lt;/strong&gt; — streams the piece to a MIDI port;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;earmuff: Show Sheet Preview&lt;/strong&gt; — opens the live sheet-music preview beside
the editor.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The language server is bundled for macOS (arm64/x64), Linux (x64/arm64), and
Windows (x64), so editor features need no extra install on those platforms. The
compile/play commands invoke the &lt;code&gt;earmuff&lt;/code&gt; CLI, which you
&lt;a href="https://earmuff.io/docs/docs/install/"&gt;install&lt;/a&gt; separately. The sheet preview needs
&lt;a href="https://earmuff.io/docs/docs/sheet-music/"&gt;LilyPond&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Examples</title><link>https://earmuff.io/docs/docs/examples/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/examples/</guid><description>&lt;h1 id="examples"&gt;Examples&lt;a class="anchor" href="#examples"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The &lt;a href="https://github.com/poolpOrg/earmuff/tree/main/examples"&gt;&lt;code&gt;examples/&lt;/code&gt;&lt;/a&gt;
directory holds complete, compilable pieces. Each one exercises a different
corner of the language:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th&gt;File&lt;/th&gt;
 &lt;th&gt;Shows&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;12bars-blues.ear&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;patterns, loops, drums&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;minor-swing.ear&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;nested loops, comping&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;nuages.ear&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;syncopation on a fine grid&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;lofi.ear&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;lists, dynamics, off-beats&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;small-jazz.ear&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;a small swing arrangement&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;bach-prelude.ear&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;a classical fragment&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;code&gt;mozart-nachtmusik.ear&lt;/code&gt;&lt;/td&gt;
 &lt;td&gt;a classical fragment&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Compile or play any of them as described in
&lt;a href="https://earmuff.io/docs/docs/command-line/"&gt;Command line&lt;/a&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;earmuff examples/minor-swing.ear
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;earmuff -pdf nuages.pdf examples/nuages.ear&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A taste — the lofi keys part comps off-beat stabs over a list of changes,
accenting the second hit of each pair:&lt;/p&gt;</description></item><item><title>Language reference</title><link>https://earmuff.io/docs/docs/language-reference/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/docs/language-reference/</guid><description>&lt;h1 id="earmuff-language-reference"&gt;earmuff language reference&lt;a class="anchor" href="#earmuff-language-reference"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This is the complete reference for the earmuff language: its surface syntax, the
execution model behind it, and the step-grid timing rules. Everything described
here is implemented.&lt;/p&gt;
&lt;h2 id="goals-from-design-discussion"&gt;Goals (from design discussion)&lt;a class="anchor" href="#goals-from-design-discussion"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Express the &lt;strong&gt;entire MIDI set&lt;/strong&gt; (notes, CC, pitch bend, aftertouch, program
change, sysex, per-event channel/port).&lt;/li&gt;
&lt;li&gt;Stay &lt;strong&gt;developer-friendly&lt;/strong&gt; and &lt;strong&gt;less verbose&lt;/strong&gt; than v1.&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;functions, patterns, loops&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Be able to &lt;strong&gt;interpret and emit MIDI live&lt;/strong&gt; as the source is processed, not
only compile to an SMF file.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="design-decisions"&gt;Design decisions&lt;a class="anchor" href="#design-decisions"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Step-grid is the default note-entry surface.&lt;/strong&gt; A block sets a default step
duration; events auto-advance one step. &lt;code&gt;on beat&lt;/code&gt; remains as an explicit
escape hatch for absolute placement.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Patterns and functions are pure.&lt;/strong&gt; Source elaborates deterministically into a
flat, time-ordered event stream. User code never touches the clock or the MIDI
port — only the scheduler does. Live playback and SMF export consume the same
elaborated stream.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Full MIDI now.&lt;/strong&gt; Raw primitives (&lt;code&gt;cc&lt;/code&gt;, &lt;code&gt;bend&lt;/code&gt;, &lt;code&gt;pressure&lt;/code&gt;, &lt;code&gt;program&lt;/code&gt;,
&lt;code&gt;sysex&lt;/code&gt;, per-event &lt;code&gt;@channel&lt;/code&gt;) are first-class, with named sugar over raw
numbers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Structured control flow, evaluated at elaboration time and pure.&lt;/strong&gt; Real
&lt;code&gt;if&lt;/code&gt;/&lt;code&gt;else&lt;/code&gt;, &lt;code&gt;for x in &amp;lt;range|list|sequence&amp;gt;&lt;/code&gt; (or unbound &lt;code&gt;for each …&lt;/code&gt;),
boolean operators, and immutable &lt;code&gt;let&lt;/code&gt;
bindings. They run during elaboration over compile-time-known values — they are
&lt;strong&gt;not&lt;/strong&gt; live/runtime branches — so the event stream is fully determined before
any MIDI is emitted. Loops are bounded (range or list, no &lt;code&gt;while&lt;/code&gt;), bindings
are immutable: this guarantees termination and keeps music diffable and
deterministic.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domain language, not general-purpose.&lt;/strong&gt; Values are musical: number, boolean,
note, chord, duration, interval, list, and pattern. No mutable state, no
strings-as-data arithmetic, no I/O from user code, no recursion/&lt;code&gt;while&lt;/code&gt; — no
Turing-completeness creep.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="1-execution-model"&gt;1. Execution model&lt;a class="anchor" href="#1-execution-model"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Two phases, one stream:&lt;/p&gt;</description></item><item><title>Playground</title><link>https://earmuff.io/docs/playground/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://earmuff.io/docs/playground/</guid><description/></item></channel></rss>