Skip to content

ABC Notation

I wrote about ABC Notation in the blog over a decade ago. The software that can use ABC has greatly improved, but the basics of the notation system, as defined in the standards, have had only minor changes.

EasyABC screenshot:

Contents:

What is it?

ABC defines a standard for a text-based system of representing music. It is similar to the original concept for guitar tablature in that it allows musical scores to be communicated via plain text documents. ABC differs from tablature systems in that instead of indicating the strings and frets to be played, it provides the standard American musical note names and durations. A tune written in ABC can be understood as is, but software can produce standard musical notation from the file.

What can it do?

Young people today may not remember a time when email was primitive and only allowed plain text messages in ASCII. Images and formatting were not supported in those days. One of the original uses for ABC was to share traditional folk music from Great Britain, Ireland, Scotland, Wales, and other places with other folk musicians. Many of the instruments played for this music can play only a single line (as opposed to polyphonic music: chords).

Changes to the standard and improvements to the software now allow ABC to score multipart tunes, display chords, convert the ABC code to standard music notation, and optionally display the music as tablature.

EasyABC, a free, open-source software package available on most platforms, plays the tune as midi output and can export the tune as PDF, midi, HTML, and MusicXML. The midi and MusicXML formats give a way to import the tunes into many other software packages.

How do I use it?

A text file in the ABC format must begin with a header that provides both background information and data required to interpret the score. But I’m going to start by skipping the header and go straight to how notes are represented.

The letter C represents middle C. The C major scale can thus be written as

Example 1

C D E F G A B c

The octave above middle C uses lowercase letters. After that, higher octaves are indicated by adding one or more apostrophes after the note. Commas denote lower octaves. Each comma or apostrophe shifts the notes another octave down or up. If you try ABC in a plain text editor or one made for ABC, you won’t encounter any problems. But, the text in this blog or in a word processor may try to convert straight apostrophes (') into “smart” curly punctuation, which won’t work.

The above is missing a few essentials. What is the duration of each note? What’s the time and key signature? OK, let’s assume the C major scale is in the key of C. But is this all in a single bar or split into two or more bars?

Part of this is answered with a header (that is required).

Example 2

X: 2 %index number within file
T: Ex.2: C Major Scale %Title
C: DLG %Composer
N: Created in VSCode with the abcjs extension %Note
M: 4/4 %Meter
L: 1/4 %Length of default note: 1/4 is quarter note 
K: C clef=treble transpose=-12 
[| C D E F | G A B c |]

The X header gives an index number to multiple tunes in the same file. A blank line must separate each tune from the previous one.

N: is for notes. Also, a % sign indicates a comment.

The K header is the key. Clef=treble isn’t required because that is the default. The transpose=-12 is to adjust the midi output for the guitar. Guitar music is written an octave higher than it sounds. The transpose directive causes the notes to sound at the correct pitches.

The following is the standard notation produced when the code is previewed in Microsoft Visual Code editor.

Screenshot of notation produced from ABC file.

Example 3

The following is a more advanced example to demonstrate other abilities of the ABC notation.

X: 3 %index number within file
T: Ex.3: Arpeggios in the C Major
C: DLG %Composer
N: Created in VSCode with the abcjs extension
M: 4/4 %Meter
L: 1/8 %Length of default note: 1/4 is quarter note 
K: C clef=treble transpose=-12 
[| "C"C E G  z "Cmaj7"cegb| "Dm"DFA "Dm7"dfac'|
| "Em7"E/2G/B/d/ z4 G2 d2 | "Fmaj7"F2 A2 c2 e2 | 
| "G7" G4 B4 | d4 f4 | "Am7" [A,CEG]4 "Bm7b5"[B,DFA]4 |]

This is the result.

The duration of notes is given by a multiplier if different from the default length set by the L: header. In this example, I used eighth notes as the default.

Chord names can be entered above the notes by putting the name in straight quotes before the note the chord name should appear over.

The letter z is entered for rests. Multipliers work the same as for notes. However, although the software should handle something like z5 properly, it is better to break the rest down into two, such as z4 z, when exporting and importing.

Writing a series of notes without spaces between them results in them being joined by beams.

A note’s duration can be divided by a factor as well as multiplied. This is how I created 16th notes in the third measure. Although not shown, this can be combined to get to the value for dotted notes. A dotted quarter note (middle C) if were L:1/4 can be indicated by C3/2.

Chord notes can be indicated by surrounding the notes in square brackets, as in the last two measures.

Software

Any plain text editor can be used to write music in the ABC notation. However, only some editors can display the results in standard notation.

EasyABC is a free, open-source, cross-platform program that can help you write in ABC. It will display the standard music notation for what you’ve created and can export in MIDI, HTML, and MusicXML, as well as print PDFs and images.

Microsoft Visual Code Editor is also a free, open-source, cross-platform program. The software may seem intimidating if you are not a coder or geeky. You need to install an extension to cause ABC to be displayed as standard notation. I use the ABCjs extension. On a Mac, press CMD-SHFT-P to reveal the “Command Palette” and then type in abc-js to get to the Show Preview command. You can move the preview from the side to the bottom of the screen by entering OPT-CMD-0.

Online, you can try either of the following.

ABC References

Standard Guitar Tuning

Standard TuningEADGBE
ASPN octaves1E2A2D3G3B3E4
ABC written guitarE,A,DGBe
ABC guitar pitchE,,A,,D,G,B,E
Midi values525762677176
Comparison of notations for standard guitar tuning.
  1. ASPN stands for American Standard Pitch Notation and provides a definition for the octaves of notes. See American Standard Pitch Notation (ASPN) – OPEN MUSIC THEORY. It should be noted that the relation between pitch (say, as a midi value or frequency) and the octave designation is not universally recognized. ↩︎

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: