The Mudcat Café TM
Thread #6195   Message #35853
Posted By: Bruce O.
24-Aug-98 - 05:53 PM
Thread Name: What is ABC format?
Subject: RE: What is ABC format?
With hopes that this is intelligible, I submit the following:

Basics of ABC. Notation is all in ASCII.

Notes:
The octave starting at middle C is denoted CDEFGAB, the next higher is c-b, then c' to a'. The octave below middle C is obtained by putting a comma after the letter, i.e., C,-- B,. For sharps, naturals, and flats preceed the note by ^, = or _, respectively. (You only have to do this for accidentals- see Key below for normal sharps and flats.)

Duration:
Indicated time 3/4, 4/4, 6/8, etc., (given after M:) all have a default normal note time which you can find explained in the file on the ABC homepage at 'abc standards'. This automatic default gave me too many surprises, so I don't usually use this default, but override it with an L:n specification, with n usually 1/8 or 1/4. Time multipliers and divisors start from the default note time.

With default note time = 1/4 then:
X2 duration is 1/4x2 or a half note
X3 duration is 1/4x3 which displays and plays as a dotted halfnote, etc.
x/2 is 1/2x1/4 = 1/8 note
x/4 is 1/4x1/4 = 1/16 note

put | to end a measure
\ indicates the tune continues, and not required at a typed line end, but I put it there to remind me what I originally typed up, (if for instance I look at it with an HTML browser), and I usually try to put the same number of measures in each typed line for ease of locating the position of an error discovered in proofreading the displayed tune.
Put ( ) around notes you want slurred.
Note times less than 1/4 note will have ties to the next note (if it's less a quarter note), unless you add a space between them, e.g. x3/4y/4 will have a tie bar between the notes but x3/4 y/4 won't

K: specifies keynote, but it really just tells the play program which notes are normally to be play as flat or sharp, and has no other effect. Major modes do not require anything other than the letter. For minor mode add m to keynote, and for others add dorian, mixolydian, etc., as required.

My ABC's then usually have a header:

X:n [specifies start of header of tune #n]
T:[Title]
S:[if you use this, info to be displayed]
Q:n [tempo, if you use this. There is also a default tempo which many times is ok]
L:n [if you use this]
M:n [n= 2/4, 3/4, 6/8, etc, timing]
K:X mode [Keynote and mode, if any]
xxx\ [tune code]
yyy\ [more tune code] ...
zzz] [End of tune code]

I usually signal end of tune by ], but this is not required

There's a lot more that you can find out about in the file downloaded from 'abc standards' [repeats, staccato, rolls, grace notes, and others], but the above gives the basics. And there's a lot more reference stuff you can put in a header with letters for information type coding, Z:xxx

With a little practice tune coding goes pretty fast, and the ASCII coded file for simple tunes runs 250-350 bytes, but lots more if there are a lot of grace notes, triplets, or dotted eighth-sixteenth note combinations.