User:Halftheisland/ABC

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name Halftheisland/ABC
Ontology
Extension(s) .abc, .abh
MIME Type(s) text/vnd.abc
Released 1993-12-08


Contents

Description

ABC Notation is a text-based (ASCII) musical notation format commonly used for folk and traditional music. It is an alphabetical shorthand, using the letters A to G to represent notes and other numbers and symbols to represent note length, sharps, flats, ornaments, etc.

While alphabetical notation systems have been used informally for a number of years, the current standard is based on work done by Chris Walshaw in the early 1990s and later revised and extended by a number of other users. The current standard is v2.1 (December 2011), with a draft v2.1.1 standard published in February 2013.

Information

Every ABC file must start with the string "%abc", which may optionally be followed by a version identifier e.g. "%abc-2.1". In order to maintain backwards-compatibility with files created according to older standards, there are two ways in which ABC files may be interpreted. Strict interpretation applies to files with a version number of 2.1 or greater, with errors reported to the user. Loose interpretation applies to files with either a version number of 2.0 or lower, or to files with no version number.

ABC files consist of three basic parts - the file header, the tune header(s) and the tune body / bodies. The file header contains processing information for the entire file e.g. typesetting and stylesheets, while the tune header contains metadata and other information such as the key, meter and standard note length of the following tune. The tune body consists primarily of ABC music code, but possibly also contains certain information fields.

File Header

As noted above, the file header contains processing information for the entire file. While many of the available information fields can be used in the file header, we have covered those mainly in the Tune Header section. However, we will look here at the I (instruction) field which has a number of uses.

  • I:abc-version can be used to indicate tunes conforming to a different standard than the one indicated at the start of the file. Presumably this appears most commonly in tune headers - while it can be used in the file header, it is hard to imagine a scenario in which this might be appropriate.
  • I:abc-include can be used to import information kept in a separate header (.abh) into the file or tune header.
  • I:abc-creator should contain the name and version number of the software used to create the ABC file (if software was used)
  • I:linebreak can be used to specify which symbol (or set of symbols) should be used to indicate score line-breaks (i.e. those line-breaks which occur in the typeset / printed score rather than those which occur in the raw code). There are four possible options for this field - $, !, <EOL> (use code line-breaks), <none> (carry out line-breaking automatically). Note that these can be combined - "I:linebreak % !" is a legal option. The default option is "I:linebreak <EOL> $"
  • I:decoration can be used to specify which of two symbols should be used to delimit decorations. The default symbol is !, but it can be set to + with this field. Note that "I:decoration +" is automatically invoked if "I:linebreak !" is set.

Tune Header

The header of an ABC file consists of a number of fields defining metadata and other information. A complete header using every field might look like this:

X:1
T:Sample Song
C:A. Composer
O:America; Nebraska; Power Cable.
A:Area
M:6/8
L:1/4
Q:"Allegro" 1/4=120
P:ABAB
Z:Tran Scriber, <t.s@notarealemail.com>
N:Notes
G:Group
H:This song was traditionally played
+:at the Power Cable, Nebraska Boot Festival
R:Polka
B:Tunes of Power Cable, Nebraska vol. I
D:Traditional Folk Music of Nebraska
F:this.is.not.a.real.url/song.abc
S:Source K:D minor

Let's break this down field by field.

  • X is the reference number. As ABC files can contain a number of tunes, this is used to identify the first, second, third, etc. tunes in the file. Thus, the first tune would be X:1, the second X:2, and so on.
  • T is the song title. As you would expect, this is used to store the title of the song.
  • C is the composer. Again, as expected, this contains the name of the composer (or, e.g. "Trad." for traditional songs where the original composer's name is lost)
  • O is the geographic origin of a tune. The data is entered in a hierarchical manner with a semi-colon to separate elements[1]
  • A is the area field. This is now deprecated and it is recommended that specific information about a tune's area of origin be entered in the O field
  • M is the meter. Information about the meter can be entered in one of three ways. The first is standard - M:6/8 or M:3/4, for example. There are also special symbols M:C and M:C| to represent common time and cut time respectively. Finally, complex meters can be specified in the format M:(2+3+2)/8 - note that the parentheses are optional.
  • L is the unit note length i.e. what length of note a single letter represents in an ABC file. This uses standard values for note length - L:1/4 is a quarter note or crotchet, L:1/8 is an eighth note or quaver, etc. Note values L:1/64 and lower are optional - they may not be supported by all ABC software. If no note field is specified, the note length is calculated based on the meter.
  • Q is the tempo, in terms of beats per minute. In the simplest form, this would be something like Q:1/2=120 (120 half-note beats per minute), but the definition can contain up to four beats e.g. Q:1/4 3/8 1/4 3/8=40. Tempo definitions may also contain a string, enclosed by quotes e.g. Q:"Allegro" 1/4=120. It is also acceptable to provide a string with no explicit tempo indication e.g. Q:"Slowly"
  • P is the parts field. This is currently used in two places - in the header, to indicate the order in which parts of tunes are played (P:ABAB), and within the tune body, to mark each part (P:A). The syntax for the parts field can become relatively complex. The simplest form is to list each part of the tune in order, e.g. P:ABABCDABE. It is also possible to use numbers to indicate number of times to repeat a part - P:A3 is equivalent to P:AAA. Where things get tricky is with the introduction of parentheses. These can be use to indicate number of times to repeat a section - P:(AB)2 is equivalent to P:ABAB - and can also be nested, making it possible to condense fairly complex sequences of repetition - P:((AB)3(CD)3E)2 would expand to P:ABABABCDCDCDEABABABCDCDCDE. Full stops / periods can be used to separate individual elements for legibility.
  • Z is the transcription field, containing information about the transcribers and editors of the tune. While there is no formal syntax for this field, the convention appears to be to use it to replace the earlier, deprecated fields %%abc-copyright and %%abc-edited-by. Note that, by convention, Z:abc-copyright will refer to the copyright on the transcription, not the original song.
  • N is the notes fields. As the name suggests, this field is for general information about the tune or transcription not pertinent to any other field.
  • G is the group field. It may be used to group together sets of tune, but there no current standard for use of this field
  • H is the history field. It is used to contain anecdotes, historical information, etc. about the tune. Note that multi-line input should use + fields following on from the initial H, not more H fields (although multiple H fields are acceptable where one wishes to record multiple, distinct anecdotes)
  • R is the rhythm field. This is used to give musicians an indication of the type of tune represented (e.g. polka)
  • B, D, F and S contain background information about the tune and where it can be found - B:book, D:discography, F:file url, S:source
  • K is the key. The first occurrence of this field always marks the end of the header. The basic structure of the key field is as follows: capital letter between A and G (key signature), # or b to indicate sharp or flat respectively (optional), mode (if none is specified, major is assumed). Note that for modes, the capitalisation is ignored and only the first three letters are parsed - K:F#MIX is equivalent to K:F# mixolydian. The key field also supports a number of more advanced parameters allowing for the specification of accidentals, clef type, etc. Note that it is possible to specify no key signature by using either an empty K field or K:none

Tune Body

The "tune code" used by ABC is too complex to allow complete coverage of every element here. However, the table below will provide a brief overview of the various elements used.

Element Usage
A-G Upper-case letters represent notes on the bottom octave
a-g Lower-case letters represent notes on the top octave
, Appearing after notes, lowers the note by one octave. Multiple commas may be used to lower multiple octaves e.g. A, B,, C,,,
' Appearing after notes, raises the note by one octave. Behaves as commas
^ Appearing before notes, represents a sharp
= Appearing before notes, represents a natural
_ Appearing before notes, represents a flat
1,2,3... Used to create notes whose lengths are multiples of the length set in field L:, e.g. if note length is set to a sixteenth note, A represents a sixteenth note, A2 an eighth note, A4 a quarter note, etc.
/ Used to create notes whose lengths are fractions of the length set in field L: e.g. if note length is set to an eight note, A/2 represents a sixteenth note. Note that these can be used either with numbers or independently - A/ is equivalent to A/2, A// to A/4, etc.

Standards

The most current version of the ABC standard can be found at http://abcnotation.com/wiki/abc:standard

Specific versions of the standard can be found at the following:

A route map of proposed developments and list of draft proposals are also available.

Software

Links

Notes

  1. ABC Standard v2.0 recommends the use of comma-separation - some legacy files may still obey this convention
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox