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. To group notes together under one beam, they should be grouped together without spaces (A B C D will produce separate single notes, ABCD will produce beamed notes)
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.
> One of two symbols used to denote broken rhythm. This is used in the form a>b to indicate that the note preceding it is dotted and the note succeeding it halved. This can be extended - a>>b, a>>>b, etc. - to indicate double-dotted / quartered, triple-dotted / divided by eight and so on
< The second symbol used to denote broken rhythm. Used in the form a<b to indicate that the note preceding it is halved and the note succeeding it is dotted. Can be extended in the same form as >
z, Z, x, X All of these denote rests and all can be lengthened / shortened in the same form as notes. "z" rests are printed in sheet music produced from the file, "x" rests are invisible. Capital letters are used to denote multi-measure rests (Z4 and z4|z4|z4|z4 are musically equivalent but will be printed differently)
` An unprocessed mark which may be placed between notes to be beamed to increase legibility
| Bar line
|] Thin-thick double bar line
|| Thin-thin double bar line
[| Thick-thin double bar line
|: Start of repeated section. This can be extended - |:: means repeat a section three times, |::: four, etc.
:| End of repeated section - can be extended as above
:: Start and end of two repeated sections. Functionally equivalent to :|: or :||:
.| Dotted bar line
[|] Invisible bar line
[1, [2 First and second repeats. Used in combinations with field P: (parts) this can be extended to denote multiple variant endings for a repeated section. In this situation, [ may be followed by any list of numbers / ranges e.g. [1,3,5-7 <notes> will play <notes> on the 1st, 3rd, 5th, 6th and 7th repeats.
- Used to tie two notes of the same pitch together
() Denotes that the notes contained within are slurred. These can be nested e.g. (AB(ABCD)CD) and can also start and end on the same note - (AB(C)DE) denotes two separate slurs, the first ending and the second starting on C.
{} Denotes the notes contained within are grace notes. Acciaccaturas (I had to look it up too) are notated with a forward slash immediately following the opening brace e.g. {/g}C
(2, (3 ... (9 Used to signify x-tuplets e.g. (3abc, (4abcd, etc.
(p:q:r A more general form of the tuplets syntax, meaning put p notes into q time for the next r notes
. Staccato mark
~, !roll! Irish roll
H Fermata
L Accident or emphasis
M, !lowermordent!, !mordent! Lowermordent
O, !coda! Coda
P, !uppermordent!, !pralltriller! Uppermordent
S, !segno! Segno
T, !trill! Trill. !trill(! is used for the start of an extended trill and !trill)! for the end
u, !upbow! up-bow
v, !downbow! down-bow !turn! turn mark / grupetto
!turnx! as above with a line through it
!invertedturn! inverted turn mark
!invertedturnx! as above with a line through it
!arpeggio! vertical squiqqle
!>!, !accent!, !emphasis! > mark
!fermata! hold / fermata
!invertedfermata! inverted fermata
!tenuto! horizontal line, indicates that note should be held for full duration
!0! - !5! fingerings
!+!, !plus! left-hand pizzicato / rasp for French horn
!snap! snap-pizzicato
!slide! slide
!wedge! wedge mark
!open! open string / harmonic
!thumb! cello thumb symbol
!breath! breath mark
!pppp!, !ppp!, !pp!, !p!, !mp!, !mf!, !f!, !ff!, !fff!, !ffff!, !sfz! dynamics marks
!<(!, !crescendo(! start of a crescendo mark
!<)!, !crescendo)! end of a crescendo mark
!>(!, !diminuendo(! start of a diminuendo mark
!>)!, !diminuendo)! end of a diminuendo mark
!D.S.! "D.S." (Da Segno)
!D.C.! "D.C." (Da Coda / Da Capo)
!dacoda! Da Coda
!dacapo! Da Capo
!fine! "fine"
!shortphrase! vertical line on upper part of staff
!mediumphrase! as above, extending to centre line
!longphrase! as above, extending to 3/4 down
s: Denotes that a symbol line should be used. These can be stacked.
H-W, h-w, ~ User-assignable symbols, using the U: field
[] Denotes that the notes contained within are part of a chord
e.g. "Am7" Chord symbols - these follow the syntax <note><accidental><type></bass> and should be contained within double quotes
e.g. "<note" Textual annotations. These should be contained within double quotes and the string must be preceded by one of five symbols: ^, _, <, >, @ which control where the annotation is placed. These are, respectively: above, below, left or right of the following note, with "@" leaving the placement up to the interpreting program

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