ABC Notation Basics
ABC is a text-based music notation format. This page only covers its basics. The full specification is here.
Structure of an ABC file
Section titled “Structure of an ABC file”An ABC file can contain one or more tunes. Before the first tune, the file can have a file header where directives and info lines are shared across all tunes. Each tune then starts with its own header lines followed by the tune body:
%%abcls-fmt courtesy-accidentals % file header: applies to all tunes%%pagewidth 21cm
X:1 % tune number (required, must be first header line)T:My Tune % titleM:4/4 % meter (time signature)L:1/8 % default note lengthK:C % key signature (must be the last header line)CDEF GABc| % some musicThe file header is the area before the first X: line. It is typically used for stylesheet directives (page layout, fonts, spacing) and abcls configuration that should apply to all tunes in the file. Any directive or setting placed in the file header acts as a default that individual tunes can override in their own headers.
Notes are written as letters. Uppercase letters represent the lower octave, lowercase letters represent the octave above:
C D E F G A B c d e f g a bOctave modifiers shift notes further up or down:
c'— one octave abovecC,— one octave belowC- These can be stacked:
c''is two octaves abovec
Accidentals
Section titled “Accidentals”Accidentals are written before the note letter:
^C— C sharp_C— C flat=C— C natural^^C— C double-sharp__C— C double-flat
^C _C =C ^^C __CRhythm
Section titled “Rhythm”Note lengths are written relative to the default length (L: header). If L:1/8, then:
A— eighth noteA2— quarter note (twice the default)A/2— sixteenth note (half the default)A3/2— dotted eighth (1.5 times the default)
A A2 A/2 A3/2 A/ A3z— rest (same length rules as notes)z2— rest lasting two default unitsZ— whole-measure rest
z z2 z/2 | Z |Bar lines separate measures:
|— regular bar line||— double bar line|]— thin-thick double bar (end of piece)[|— thick-thin double bar:|and|:— repeat bars, can be numbered using:|1,2
Chords
Section titled “Chords”Square brackets group simultaneous notes into a chord:
[CEG] [FAc] [GBd]Chord symbols
Section titled “Chord symbols”Chord symbols are written in double quotes before a note:
"Cmaj7" c "Dm7" d "G7" GNote that content in double quotes can also be anything you want to write.
Further reading
Section titled “Further reading”- ABC notation standard (v2.2) — the full specification
- ABC notation tutorial — a more comprehensive introduction
- ABCJS library — the rendering library used by abcls for preview