New Hampshire Country Dance Fiddle Tunes Website

Introduction to abc Notation


Ornament

A Look at the Parts of an abc Document

Here we look at the parts of an abc document, illustrated by an example.

There are two parts to the section on abc notation. This is part of the Introduction to abc Notation section. Please use the abc Notation menu above to navigate the abc pages.

On the previous page we looked at an example of some abc code for the tune Amelia. On this page we look at how an abc document works in a bit more detail. All of this is presented in more detail later on. For casual use of abc notation this may be adequate.

The Parts of an abc Document

Here is an overview of the parts of an abc document and their function.

The music code. This is the part of greatest interest to most users of abc documents. The abc code for the melody and chords are found in the tune body. Sometimes formatting commands are found there too, e.g. to indicate a key change.

  • As described on the previous page, pitch is indicated by the letters A-G, and duration of notes by numbers.

Tune characteristics & formatting. There’s more to the music than melody and chords. The software needs to know tune characteristics such as key and time signature. It also needs to know how we want it drawn (e.g. font and font size for the title, composer and other information, spacing between staff systems, margins, and more. This is done in the headers. There are a few types of headers, each serving a different function.

  • The tune header begins the tune. It contains a set of information statements describing the tune (e.g. its name, time signature, key).

  • The document file header is an optional section that appears at the beginning of an abc document, or sometimes as a separate file. It consists of a set of formatting commands (e.g. for the fonts to be used, their size, spacing, etc.). It applies to all abc tunes in a document.

  • Because people are likely to get abc files from abc search websites (see the abc Links tab), anything outside the tune header and body are likely to get lost. Therefore I place the tune file header inside the tune even though that's technically incorrect.

  • For the same reason the document file header is likely to be separated from the rest of the tune. Therefore I've included the document file header on the website with a link in the body of each tune.

For more about how abc notation works and the different parts of an abc document, go to The abc Document.



A More Detailed Example

We'll stick with Amelia, but I'll add in a few more portions of abc code. This is adapted from the code used for the tune on this website. Note that anything after a "%" symbol is a comment and isn't interpreted by the abc software. Rather than break up the code, I'll use comments to explain the parts of the abc code.

  • This may be difficult to read on a small phone. You could try turning it to landscape orientation.
    
% One percent sign tells the abc interpreter that this is a comment.
% Two percent signs tells the software that it's a formatting command.

% ------------ The Document File Header ------------

% Here is an abbreviated version of the document file header. It sets up
% much of the formatting for all abc tunes in the document.

%abc-2.2                                  % An abc tune should start by 
I:abc-charset utf-8                       % stating the abc version it follows


% %%pagewidth      8.5in
%%leftmargin     0.0in
%%rightmargin    0.5in
%%titlefont      Palatino-Bold 20         % Font of title
%%subtitlefont   Palatino-Italic 16       % Font of second title
%%composerfont   Palatino-Italic 14       % As it says
%%tempofont      Palatino-Roman 14        % As it says
%%gchordfont     Palatino-Bold 14         % Chord font

% It can be useful to have the option to change fonts for a couple words.
% For example, in a listing of sources some words should be italicized.

%%setfont-1      Palatino-Bold 16         % Allows changing font within a
%%setfont-2      Palatino-Italic 16       %    string. $1, $2 to change, $0 to
%%setfont-3      Palatino-Italic 20       %    change back to the default

% ------------ The Tune File Header ------------

% Now I include a brief tune file header. It comes right before an individual
% tune and only applies to that tune.

%%pagescale 0.95                           % Shrinks everything to fit better

% ------------ The Tune Header ------------

% Now we get to the tune header. It gives information about the tune for the
% abc reader and for the human reader. Once we start we can't have any more blank
% lines until the end of the tune. You can use a blank comment line.

% Each letter has a specific meaning: X for tune number, T for title, C for 
% composer, S for source, H for history, M for meter, L for default note
% length (length of a letter with no number), R for rhythm, G for grouping,
% N for notes and K for key.

X:542403
T:Amelia
C:Bob McQuillen
S:Bob McQuillen, $2Bob's Note Book #5.$0 Dublin, NH, 1981.
S:New England Tradition, $2Farewell To The Hollow.$0 Whistler's Music,
S:CDWM 9860, 1988 and 1991.
S:Old New England, $2Old New England.$0 O.N.E. CD101, 1996.
H:Notation as Bob wrote the tune, chords from the New England Tradition recording
H:as well as I can hear them. Where there are two rows of chords, the
H:bottom row represents the second A or B part, as played on the first
H:Old New England recording. There is another version based on the playing
H:of Rod and Randy Miller. Here's what he wrote in his Note Book:
H:
H:"Now here is a tune for Deanna's sweet daughter;
H:If you haven't met her yet, you really ought ter."
M:3/4
L:1/8
R:Waltz
G:Couples Dances ~ Waltzes ~ LRB
N: Tune Tags ~ Waltz, New England Repertoire, New Hampshire, LRB, Bob McQuillen
K:D
%%text $2As Written by Bob McQuillen$0
%
% ------------ The Tune Body ------------
%
% And finally we get to the tune body, which contains the music.
A,2|\
"D" D3ED2  | "D" D2F3E   | "D" D2F2 "G" B2     | "D" A4A2 |\
"G" B3GB2  | "D" A2F2E2  | "Bm" D2B,3B, | "G" B,4 "A7" A,2 |
"D" D3ED2  | "D" D2F3E   | "D" D2F2 "G;D" B2   | "D;F#m" A4A2 |\
"G" B3cd2  | "Em" d2e2f2 | "A7" e3cB2   | "A7" A4 :|
|: a2 |\
"D" f2a3f  | "D" a2f2d2  | "A" e3cA2    | "A" A4fe |\
"Bm" d3Bd2 | "Bm" f2d2B2 | "F#m" c3AF2  | "F#m" F4A2 |
"G" G2B3G  | "D" F2A2d2  | "A7" e3cA2   | "D;Bm" d4f2 |\
"G" g3fe2  | "D"a2 "Bm" f2 d2 | "G" d2 "A7" e3c | "D" d4 :|

A Comment About the Code

You probably noticed that I did my best to line things up. Some people actually read abc code directly. But even for those of us who don't, it's a whole lot easier to make sense out of well-formatted abc code than it is when little or no effort has been made to format it. If you have to edit the code or work with it in any way you're likely to appreciate well-formatted code.

The Resulting Music

All of this abc code can be interpreted by abc software. The results would look something like this. Note that for this I'm using the code from the playable tune section which gives nicer output than the code from the plain abc section.




Connecting the Music and the Code

Try looking at the code and at the notation and see if you can see the relationship between them. For example, in the first full measure "D3" would have a note value of three times the default length of an eighth note; thus the dotted quarter note. It's followed by a "E" with no number after it, so it's an eighth note. The letters in quotation marks are chords. The case of the letter determines its pitch. Notes from the C just below the staff to the B in the middle are represented by capital letters. From the next C to the high B lower-case letters are used. For really low notes a capital letter is followed by a comma, and for really high notes a lower-case letter is followed by an apostrophe.

By the way if you click on the tune it will play with a basic chord accompaniment. Click in the white space near the tune to stop playback. For some reason I've been having problems with this one cutting out inn the middle. If you click after the problem spot it should start up again.

All of this is covered in more detail later in this section.

On the Next Page: Software for abc Notation

One of its desirable qualities is that abc software is either free or very inexpensive. Beyond that it has several other qualities that make it very useful. Take a look at the next page for details.