How to Write ABC Music Files for Hymns

"ABC" is a music language that was invented by a guy in Great Britain named Chris Walshaw. The purpose of ABC is to make it easy for people to type in music using plain text with a computer keyboard.

The ABC language is very simple and can be used to make many kinds of music from a simple melody to a symphony score. This document explains how to use ABC to type music for hymns that are arranged for four vocal parts, SATB (soprano, alto, tenor, bass).

Getting Started

To make an ABC file, you should use a plain text editor, such as WordPad. When you start WordPad, you can create a new, empty text file. Click File + New and then select Text Document.

A Simple ABC Example

Below is a very simple example of an ABC music file.

X: 1
T: God Is So Good
M: 4/4
L: 1/4
C: Traditional
%%staves (1 2) (3 4)
K: Eb
V: 1
 E2 E G | F4 | F2 F A | G4 |
 G2 G B | A2 F A | G2 F2 | E4 |]
V: 2
 B,2 B, E | D4 | D2 D D | E4 |
 E2 E _D | C2 E E | E2 D2 | B,4 |]
V: 3
 G,2 G, B, | B,4 | B,2 B, B, | B,4 |
 B,2 B, G, | A,2 A, A, | B,2 A,2 | G,4 |]
V: 4
 E,2 E, E, | B,,4 | B,,2 B,, B,, | E,4 |
 E,2 E, E, | A,,2 C, =B,, | B,,2 B,,2 | E,4 |]

Using the typesetting program you can view or print the ABC file in standard music notation. The typesetting program is called jhabc2ps and it produces Postscript output. Below is how the simple example looks after typesetting.

You can also play the ABC file to hear how it sounds. The ABC player is a program called abc2midi. Click here to listen to the simple example.

As you can see, the ABC file has a heading that tells the information about the tune. The heading is followed by the notes of the tune for the four voices. We will now explain how to type the heading and the notes.

The ABC Heading

Each line in the heading begins with a capital letter. This is what each letter means.

LetterWhat it meansIs required?
X:tune number (always use 1)YES, must be first
T:title of the tuneYES, must be second
M:time signatureYES
L:unit note (always use 1/4)YES
C:composer or sourceno
Z:transcriber (your name)no
N:notesno
K:key signature, ex. F, Eb, Dm YES, must be last

The line %%staves (1 2) (3 4) defines the layout of the voices. It means that there are four voices arranged onto a grand staff.

Note: The ABC tune cannot have any blank lines. Each line in the ABC heading must start with one of the capital letters above. If the heading information doesn't fit on one line, you can add more lines with T:, C:, or N:. For example,

X: 1
T: This is the title
T: This is the sub-title
M: 4/4
L: 1/4
C: One composer name can go here
C: and another composer or source name can go here
N: This is a note about the song.  This song is a very
N: simple song and the composer is anonymous, though
N: it is probably 19th century American in origin.
.... etc, etc.

The Z: and N: information will not be printed in the hymnal. They are just for the benefit of others who might look at the ABC file and like to know more about where this tune came from.

The ABC Voices

For the purpose of hymns, we always use four voices. The voices are identified by number as follows. V: 1 is the soprano part
V: 2 is the alto part
V: 3 is the tenor part
V: 4 is the bass part
You type in the notes for each voice separately. Thus, following the V: 1 you type the soprano notes, and so on.

Pitch of a note

Each note has a pitch and duration. The pitch of a note is indicated by a letter, for example, "C" is a middle-C on the piano. The notes above middle-C simply use the uppercase and lowercase letters, as in the following picture.

The notes in the octave below middle-C have one comma after them. And the notes two octaves below middle-C have two commas after them. The bass clef notes are as follows.

The pitch of a note depends on the key signature. You can type notes that are not in the key signature by using accidentals.

Use ^A to make a sharp accidental.
Use _A to make a flat accidental.
Use =A to make a natural accidental.
Important! If the same note has the same accidental many times in the same measure, only the first note should have an accidental.

Duration of a note

The duration of a note is a number or a fraction following the note letter. The unit of duration is a quarter note (as set by L: 1/4). For example, "A2" is a half note, and "A4" is a whole note. A note without any duration is a quarter note. For shorter notes, you can think of the "/" as a flag. Thus, "A/" is an eighth note, "A//" is a sixteenth note, and so on.

To create dotted notes you can use fractions. A dotted quarter note is one-and-a-half or "A3/2". A dotted eighth note is "A3/4", and so on.

A dotted pair, also called a broken rhythm, is very common in music and so ABC has a shorthand for it. Instead of "A3/4 B//" you can use shorthand "A/ > B/". The ">" makes the first note 50% longer and the second note 50% shorter. The "<" is just the opposite; it makes the second note 50% longer.

Notice in the previous example how spaces affect the beaming. If you type eighth notes or sixteenth notes with no space between them, then they will be combined into one beam.

Rests

Occasionally, you may need to use a rest to indicate a pause in the singing. A rest is exactly like a note using the letter "z". Thus, "z" is a quarter rest,
"z/" is an eighth rest, "z2" is a half rest,
"z4" is a whole rest,
.... and so on.
The letter "x" can be used as an invisible rest. An invisible rest might be useful to omit the notes of the alto or tenor voices, (though usually you should use a unison instead).

Measure Bars

You need to type the bars in ABC music. A single bar is simply a vertical line "|" (locate this key on your keyboard). Use "||" for double bar. Always put "|]" at the end of the each voice.

For repeats, use "|:" and ":|". However, for the Little Flock hymns, it is best to not use repeats. Just copy the notes.

Note: you do not need to put measure bars in the "right" places. Very often the first measure of a song (called the pick-up) does not have a full count. Also, you might want to add extra bars in the middle of a measure to mark the end of a phrase. If you do this, the typesetting program might print a warning, but you can just ignore it.

The most important rule regarding measures is that all the voices should be consistent. The first line of the soprano part must have the same number of measures and bars as the first line of alto part, and so on.

When you are typing the notes of a tune, try to type just one natural phrase for each line. As an example, #14 in Grace and Truth is typeset with three lines of six measures. However, this tune is C.M. (with repeat) and so its natural phrasing is five lines (8, 6, 8, 6, 6). If you were to type this tune in ABC, it would be best to use five lines, instead of three.

A Second Example

Let's try out what you've learned so far with a hymn. We will try Thy Sorrows, Saviour, We Retrace #25 in Grace and Truth. The heading of this hymn will look something like this.

X: 1
T: Immanuel
T: (c) 1903 Loizeaux Bros.
M: 4/4
L: 1/4
C: C. and F. Jouard
Z: John Henckel, 2000
%%staves (1 2) (3 4)
K: Bb

We don't type information here about the words or author of the hymn. This is only the tune, because the same tune might be used for different words.

Next we type in the notes for each voice. Below, you can see the first two phrases of the music. (The rest of the tune is left as an exercise for the reader).

V: 1
  D F/ > G/ F B/A/ | G B F2 |
  F G/ > D/ E > C | F E D2 |
V: 2
  B, D/ > ^C/ D F | E E D2 |
  D D/ > _A,/ G, > G, | A, A, B,2 |
V: 3
  F, B,/ > B,/ B, B, | B, B, B,2 |
  F, F,/ > F,/ E, > E, | C, F, F,2 |
V: 4
  B,, B,,/ > B,,/ B,, D, | E, G, B,2 |
  B,, B,,/ > =B,,/ C, > C, | F,, F,, B,,2 |

Now we save the file and give it a meaningful name, like Immanuel.abc. Using the typesetting program we can view the output below, or listen to the midi file, click here.

Note! We do not put two phrases on one line as in Grace and Truth. Always only one phrase per line. (The typesetting program can be used to combine short lines, but it will depend on the book layout).

Slurs and Ties

When two or more notes are sung on the same syllable, then the notes should be joined by a curved line, called a slur.

To make a slur in ABC, simply put parentheses around the notes. For example, the first line of the hymn Jesus! How Much Thy Name Unfolds (#28 in Grace and Truth) will look like this

V: 1
  B | (B G) B | (A F) A | (G A) G F2 |
V: 2
  G | (G E) G | (F D) F | (E F) E D2 |

And after typesetting it looks like

A "tie" is simply a slur between two notes of the same pitch. You can use parentheses for a tie, or you can use dash "-" between the two notes. Thus, "(B B)" or "B- B" draws a tie, and "(B | B)" or "B- | B" draws a tie across a bar.

Triplets

A triplet is a notation to play three notes in the time usually required for only two notes. To make a triplet in ABC, you precede the three notes with "(3". This is an odd notation because the parenthesis does not have a match, but that's how it is.

The following example shows some triplets. The second triplet also has a slur.

ABC: (3F G A ((3A G) F | (3G/ F/ E/ (3A/G/F/

Changing Key or Clef

To change the key signature or the clef in the middle of a tune, you use the "[K: ]" notation. You must ensure that all the voices change to the same key at the same time. The following is an example of some key changes.

ABC: E D C B, | [K:bass] a g f e | [K:Eb] d e f g | [K:C treble] A, B, C D

Notice one idiosyncrasy of using the "[K: bass]" notation is that all notes are transposed two octaves down. This is meant to be a convenience, so that you don't have to type so many commas.

Other Decorations

ABC offers a wealth of decorations. Most of these will never be used in a hymn, but I list them here just in case you have some use for them. In all cases the symbol for the decoration goes in front of the note in the ABC file (without any space between them). For example, to make a fermata over a middle-C you type "HC".

SymbolWhat it meansExample
Hfermata Hc
.stacato .B
Jslide JA
~turn ~F
Rroll RE
Ttrill TF
uupbow uG
vdownbow vA
!tenuto!tenuto !tenuto!B
!mordent!mordent !mordent!c
!uppermordent!upper mordent !uppermordent!E
!segno!a sign with two dots !segno!F
!sfz!sfz !sfz!G
!coda!a cross-hair sign !coda!A
!D.S.!D.S. !D.S.!B
!D.C.!D.C. !D.C.!c
!dyn!dynamics markings !p!d !mf!e !f!E
!n!fingering numbers !1!F !2!G !3!A !4!B
{notes}grace notes {B/}c {G//A//}G

And this is how the example decorations look after typesetting.

The location of the decoration is above or below the note. Soprano decorations are above the note, alto decorations are below, and likewise with tenor and bass. A decoration can be attached to a note, a rest, an invisible rest, or a measure bar.


That's all I have to say. If you have any questions or complaints please send me an email.

John Henckel, henckel@iname.com