barmark
Musicians have written chord charts in plain text for decades: a row of bars between pipes, a chord or two in each, a heading for the verse. People read them easily. Machines do not, because the conventions are ambiguous in exactly the places that matter. Does an empty cell mean silence or the same chord again? Does "x 2" repeat the last chord or the whole line? barmark answers those questions in a written grammar, so a chart means the same thing to a band, a parser and a renderer.
A barmark file is a markdown file with the extension .chart.md, so any markdown tool shows it sensibly on day one. The barmark package reads it; the @barmark packages below show it as a bar grid or a full score, move it to and from MusicXML and MIDI, line it up with a recording, and do all of that from a terminal.
barmark was extracted from the chart parser in Stem Shovel, our music collaboration app, and its rules were checked by our stem-bench studies against real recordings. The grammar is a v0.1 draft, open for review. The code is MIT licensed, and the specification will be published under CC-BY 4.0.
bun add barmark @barmark/render barmark.dev →GitHub →npm: barmark →
The Packages
Read a chart
- barmark
The parser: bars in play order, sections, key, meter and tempo, with line-numbered diagnostics. It never throws, prints charts back in a canonical spelling, and converts chord symbols to and from Harte labels. No runtime dependencies.
Show a chart
- @barmark/render
An evenly spaced, accessible bar grid: server-rendered HTML that needs no browser JavaScript, or the <barmark-chart> web component, in light and dark themes.
- @barmark/score
The <barmark-score> web component: the same bar grid, plus a switch to a full engraved score, drawn by Verovio. Verovio loads on the first switch to the score, not with the page, unless you ask it to.
Move a chart between formats
- @barmark/musicxml
MusicXML 4.0 export and import, for MuseScore, Dorico, Sibelius and Finale: chords, voicings, repeats, endings, jumps and several parts, in play order, checked against real MuseScore 4 files.
- @barmark/midi
Exports a chart's play order as a Standard MIDI File and imports a MIDI file as a chart, with no MIDI library underneath. The chart-to-timed-notes core is available on its own.
Line a chart up with a recording
- @barmark/sync
Builds a first-draft chart from a chord detector's bars and chords, and defines the timing map, a small JSON file recording when each played bar starts, with a checker and the lookups a player needs.
Work from a terminal
- @barmark/cli
The barmark command: check charts and report problems by file and line, format, render a standalone page, transpose and export, in a terminal or CI, with standalone binaries for machines without Node.
Experimental
- @barmark/engraver Experimental · LGPL-3.0
A smaller build of Verovio 6.4.1, made by barmark, not by the Verovio project: about 1 MB gzipped instead of 2.4, and checked to draw what stock Verovio draws for the scores barmark asks it for.
What It Does
- A written grammar for the plain-text bar grid, with each trap documented
- Parsing never throws: broken lines are reported with line numbers and the rest still reads
- A canonical printer that changes spelling and layout only, never meaning
- Harte chord labels in both directions, checked against the McGill Billboard and Isophonics Beatles datasets