ABC plus

From CCARH Wiki
Revision as of 19:16, 16 December 2010 by Craig (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The ABC data format was originally designed for monophonic folksongs. ABC plus is an extension of the data format to accomodate polyphonic music, although the representation is not completely generalized for complex graphical notation.

Beethoven Sonata Example in ABC plus

The following music is a fairly complex example of ABC Plus musical data. Compare a graphical version of the original edition (edited by Paul Dukas and published in 1915):

Here is graphical notation resulting from sending the data found below into the program abcm2ps:

Note that dynamics were not encoded in the example (and therefore were not printed in the above PDF file). ABC plus allows for up to two voices on a staff (original ABC format only allowed for one voice on a staff).

As a comparison, here is the same music entered into a general-purpose music notation editor which allows more control over layout (such as stem direction and slur placement):

The ABC data starts with a header:

X: 1
T: Piano Sonata no. 1 in F minor, mvmt. 1
C: Ludwig van Beethoven
%%abc-version 2.0
%%gracespace 0 6 6
%%notespacingfactor 2
%%scale 0.7
%%continueall 1
%%barnumbers 0
L: 1/4
M: 2/2
Q: "Allegro" 1/2=120
%%staves {1 2}
V: 1 clef=treble
V: 2 clef=bass
K: Ab

Traditional ABC header entries start with a single capital letter followed by a colon. ABC plus extensions are listed as ABC comments which start with the % symbol.


Header
marker
Meaning
X Start of music
T Title
C Composer
L Basic rhythmic unit
M Meter
Q Tempo marking
V Voice information
K (Initial) Key signature

Following the header is the musical data. In this case each line represents one measure of music for a particular staff in the score. The left- and right-hand staves are interleaved, with [V:1] being the top staff in the system and [V:2] being the bottom staff. The layout of the data by measures is arbitrary, and any segmentation of the left and right hand parts can be done. For example all of staff one's data could be given and then all of staff two's data, as in the lilypond example.

Here is the pick-up measure and first full measure of the piece:

[V:1] .C | 
[V:2] z | 
[V:1] .F.A.c.f [I:setbarnb 2]| 
[V:2] z4 | 

The line:

  [V:1] .C |

contains a staccato note on middle C. The period before the "C" represent the staccato, and the upper-case C represent middle C. The z in the second line is a quarter-note rest.

The line:

  [V:1] .F.A.c.f [I:setbarnb 2]| 

Contains four quarter notes on pitches F3 A3 C4 and F4, all of which have staccatos. The string [I:setbarnb 2] is an embedded header entry which causes the next barline to be labeled as measure 2 (because the first measure is a pickup and should be labeled as measure 0). The fourth line above (z4) is a whole-note rest.

Look at the automatically generated notation output for the following data to see what the codes mean in terms of notation.

Comments

Although ABC plus graphical notation output is not a full-featured as lilypond which will limit its use to less-complex music, it has several advantages:

  1. Much faster at rendering graphical notation. Compared to lilypond which takes 7 seconds to generate a PDF of Beethoven Piano Sonata No. 1, mvmt. 1, [abcm2ps] takes 0.012 seconds to generate a PostScript version of the graphical music, and it takes an additional 0.329 seconds to convert the PostScript file into a PDF file with ps2pdf. In other words, generating notation from ABC plus data is 20 times faster than with lilypond (580 times faster if you only want PostScript). This is a significant difference for on-demand generation of graphical music notation from the data (notice that Mutopia PDF files are precompiled).
  2. Inter-staff spacing in systems is much tighter than in lilypond.
  3. Rests in mm72-79 are placed correctly.
  4. Barlines are the correct thickness for multi-staff parts.

Automatic-generated notational problems in abcm2ps for this example:

  • Grace note stem lengths too long in m8. Also mm85-88.
  • Collision of the slur and triplet mark in m11, m13, m14.


Full Example

X: 1
T: Piano Sonata no. 1 in F minor, mvmt. 1
C: Ludwig van Beethoven
%%abc-version 2.0
%%gracespace 0 6 6
%%notespacingfactor 2
%%scale 0.7
%%continueall 1
%%barnumbers 0
L: 1/4
M: 2/2
Q: "Allegro" 1/2=120
%%staves {1 2}
V: 1 clef=treble
V: 2 clef=bass
K: Ab
[V:1] .C | 
[V:2] z | 
[V:1] .F.A.c.f [I:setbarnb 2]| 
[V:2] z4 | 
[V:1] (a3/(3g//f//=e//.f)z | 
[V:2] z[F,A,C][F,A,C][F,A,C] | 
[V:1] .G.c.=e.g | 
[V:2] [=E,G,B,C]zz2 | 
[V:1] (b3/(3a//g//f//.g)z | 
[V:2] z[=E,G,B,C][E,G,B,C][E,G,B,C] | 
[V:1] {/c}(a3/(3g//f//=e//.f)z | 
[V:2] z[F,A,C][F,A,C][F,A,C] | 
[V:1] {/c}(b3/(3a//g//f//.g)z | 
[V:2] z[G,B,=E][G,B,E][G,B,E] | 
[V:1] !arpeggio![c2f2a2c'2](b/a/g/f/) | 
[V:2] z[A,CF]z[B,DG] | 
[V:1] {=e/f/g/}(fe)!fermata!zz | 
[V:2] z[CG]!fermata!z.G,, | 
[V:1] z4 | 
[V:2] .C,._E,.G,.C | 
[V:1] z4 | 
[V:2] (E3/(3=D//C//=B,//.C).C | 
[V:1] zz/ (3(e//_d//c//.d).d & A4- | 
[V:2] [C4F4] | 
[V:1] d4- & A3/(3(B//A//G//).A.A | 
[V:2] [B,4F4] | 
[V:1] d3/(3(e//d//c//.d).d & G4 | 
[V:2] [B,4E4] | 
[V:1] zz/ (3(d//c//=B//.c).c & A4 | 
[V:2] [A,4E4] | 
[V:1] (cB2A) & F4 | 
[V:2] D2=D2 | 
[V:1] .G(ed)c- | 
[V:2] Ezz([CE] | 
[V:1] (cB2A | 
[V:2] [D2F2])[=D2F2] | 
[V:1] G)([Ee][_D_d][Cc])- | 
[V:2] Ezz([C,E,] | 
[V:1] ([Cc][B,2B2][A,A] | 
[V:2] [D,2F,2])[=D,2F,2] | 
[V:1] [G,G])zz(_f | 
[V:2] E,/E/E,/E/ E,/E/E,/E/ | 
[V:1] edBG) | 
[V:2] E,/E/E,/E/ E,/E/E,/E/ | 
[V:1] (_F>E.A)(_f | 
[V:2] (D2C)x & E,E,E,/E/E,/E/ | 
[V:1] edBG) | 
[V:2] E,/E/E,/E/ E,/E/E,/E/ | 
[V:1] (_F>E.A)(_f | 
[V:2] (D2C)x & E,E,E,/E/E,/E/ | 
[V:1] edBG) | 
[V:2] E,/E/E,/E/ D/E/D/E/ | 
[V:1] z/ (G/B/A/) z/ (=A/c/B/) | 
[V:2] C/E/C/E/ G,/E/G,/E/ | 
[V:1] z/ (=B/d/c/) z/ (=d/a/d/) | 
[V:2] A,/E/A,/E/ F,/=D/A,/D/ | 
[V:1] ezz/ (=d/a/d/) | 
[V:2] E,/E/G,/E/ F,/=D/A,/D/ | 
[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[K:clef=bass]z | 
[V:1] .A.c.e.a [I:setbarnb 50]| 
[V:2] z4 | 
[V:1] (c'3/(3b//a//g//.a)z | 
[V:2] z[A,CE][A,CE][A,CE] | 
[V:1] {/d}(d'3/(3c'//b//=a//.b)z | 
[V:2] z[G,B,DE][G,B,DE][G,B,DE] | 
[V:1] .B.d.g.b | 
[V:2] z4 | 
[V:1] {/d}(d'3/(3c'//b//=a//.b)z | 
[V:2] z[G,B,D=E][G,B,DE][G,B,DE] | 
[V:1] {/d}(d'3/(3c'//b//=a//.b)z | 
[V:2] z[_G,B,D=E][G,B,DE][G,B,DE] | 
[V:1] =azz(_g | 
[V:2] F,/F/F,/F/ F,/F/F,/F/ | 
[V:1] fec=A) | 
[V:2] F,/F/F,/F/ F,/F/F,/F/ | 
[V:1] (_G>F.B)(_g | 
[V:2] (E2D)z & F,F,F,/F/F,/F/ | 
[V:1] fec=A) | 
[V:2] F,/F/F,/F/ F,/F/F,/F/ | 
[V:1] (_G>F.B)(_g | 
[V:2] (E2D)z & F,F,F,/F/F,/F/ | 
[V:1] fec=A) | 
[V:2] F,/F/F,/F/ E/F/E/F/ | 
[V:1] z/ (=A/c/B/) z/ (B/d/c/) | 
[V:2] D/F/D/F/ C/F/C/F/ | 
[V:1] z/ (c/e/d/) z/ (=B/=d/c/) | 
[V:2] B,/F/B,/F/ A,/^F/A,/F/ | 
[V:1] =Bzz(a | 
[V:2] G,/G/G,/G/ G,/G/G,/G/ | 
[V:1] gf=d=B) | 
[V:2] G,/G/G,/G/ G,/G/G,/G/ | 
[V:1] (A>G.c)(a | 
[V:2] (F2E)x & G,G,G,/G/G,/G/ | 
[V:1] gf=d=B) | 
[V:2] G,/G/G,/G/ G,/G/G,/G/ | 
[V:1] (A>G.c)F/=D/ | 
[V:2] (F2E)(A, & G,G,G,x | 
[V:1] F/=D/F/D/ F/D/F/D/ | 
[V:2] G,F,=D,=B,,) | 
[V:1] z(=Bc)z & F/=D/F/D/ E/C/E/C/ | 
[V:2] (A,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 | 
[V:1] .f).fz([ff'] | 
[V:2] A,/C,/C/C,/ =B,/C,/=D/C,/ | 
[V:1] .[=e=e']).[ee']z([_d_d'] | 
[V:2] C/C,/C/C,/ B,/C,/B,/C,/ | 
[V:1] .[cc']).[cc']z([ff'] | 
[V:2] A,/C,/C/C,/ =B,/C,/=D/C,/ | 
[V:1] .[=e=e']).[ee']z([dd'] | 
[V:2] C/C,/C/C,/ _B,/C,/B,/C,/ | 
[V:1] .[cc']).[cc']z([ff'] | 
[V:2] A,/C,/C/C,/ =B,/C,/=D/C,/ | 
[V:1] .[=e=e'])zz2 | 
[V:2] (.C.C.C.C) | 
[V:1] z4 | 
[V:2] (.C.C.C.C) | 
[V:1] zz/ (3(A//_G//F//.G)z | 
[V:2] (.[CD].[CD].[CD].[CD]) | 
[V:1] zz/ (3(e'//d'//c'//.d')z | 
[V:2] (.[B,D].[B,D].[B,D].[B,D]) | 
[V:1] zz/ (3(F//=E//=D//.E)z | 
[V:2] (.[B,C].[B,C].[B,C].[B,C]) | 
[V:1] zz/ (3(d'//c'//=b//.c')z | 
[V:2] (.[A,C].[A,C].[A,C].[A,C]) | 
[V:1] zz/ (3(E//=D//C//.D)z | 
[V:2] (.[A,B,].[A,B,].[A,B,].[A,B,]) | 
[V:1] zz/ (3(c'//b//=a//z.b) | 
[V:2] (.[G,B,=E].[G,B,E].[G,B,E].[G,B,E]) | 
[V:1] .F.A.c.f | 
[V:2] [F,A,C]zz2 | 
[V:1] (a3/(3g//f//=e//.f)z | 
[V:2] z[F,A,C][F,A,C][F,A,C] | 
[V:1] .G.c.=e.g | 
[V:2] [=E,G,B,C]zz2 | 
[V:1] (b3/(3a//g//f//.g)z | 
[V:2] z[=E,G,B,C][E,G,B,C][E,G,B,C] | 
[V:1] {/c}(a3/(3g//f//=e//.f)z | 
[V:2] [F,2A,2C2]z2 | 
[V:1] {/c}(b3/(3a//g//f//.g)z | 
[V:2] [G,2B,2=E2]z2 | 
[V:1] !arpeggio![c2f2a2c'2](b/a/g/f/) | 
[V:2] [A,CF]z[B,DG]z | 
[V:1] {=e/f/g/}(f=e)!fermata!zz | 
[V:2] [CG]z!fermata!z.C, | 
[V:1] z4 | 
[V:2] .F,.A,.C.F[K:clef=treble] | 
[V:1] z4 | 
[V:2] (A3/(3G//F//=E//).F.F | 
[V:1] (b3/(3a//_g//f//.g).g | 
[V:2] [F4_G4] | 
[V:1] _g4- & zz/ (3_d//c//=B//.c.c | 
[V:2] [E4_G4] | 
[V:1] g3/(3(_g//f//=e//.f).f & c4- | 
[V:2] [E4=A4] | 
[V:1] f4 & c3/(3c//B//=A//.B.B | 
[V:2] [D4F4] | 
[V:1] zz/ (3(g//f//=e//)(fg & =B4 | 
[V:2] (F3=E) & =D4- | 
[V:1] a=ef=B) | 
[V:2] (FGAF) & D4 | 
[V:1] (c=efg | 
[V:2] (=EGFE & C4- | 
[V:1] a=ef=B | 
[V:2] FBAF)[K:clef=bass] & C2_D2 | 
[V:1] [=Ec])zz(d | 
[V:2] C,/C/C,/C/ C,/C/C,/C/ | 
[V:1] cBG=E) | 
[V:2] C,/C/C,/C/ C,/C/C,/C/ | 
[V:1] (D>C.F)(d' | 
[V:2] (B,2A,)z & C,C,C,/C/C,/C/ | 
[V:1] c'bg=e) | 
[V:2] C,/C/C,/C/ C,/C/C,/C/ | 
[V:1] (d>c.f)(d' | 
[V:2] (B,2A,)z & C,C,C,/C/C,/C/ | 
[V:1] c'bg=e) | 
[V:2] C,/C/C,/C/ B,/C/B,/C/ | 
[V:1] z/ (=e/g/f/) z/ (f/a/g/) | 
[V:2] A,/F/C/F/ G,/=E/B,/E/ | 
[V:1] z/ (g/b/a/) z/ (=b/f'/b/) | 
[V:2] F,/C/A,/C/ D,/=B,/F,/B,/ | 
[V:1] c'zz/ (=b/f'/b/) | 
[V:2] C,/C/=E,/C/ D,/=B,/F,/B,/ | 
[V:1] c'zz/ (=e/d'/e/) | 
[V:2] C,/C/=E,/C/ _B,,/G,/D,/G,/ | 
[V:1] fzz/ (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