ABCp
 the ABC Parser
last update: 09 Dec 2004  



 :: Home
 :: News
 :: Docs
 :: Download

 :: Links

 :: Contacts

Hosted on
SourceForge.net Logo
Remo Dentato '04

ABCp syntax

9 Dec 2004

Contents
    1. Introduction
    2. File structure
    3. Notes
    4. Fields
    5. Line continuation
    6. Keys
    7. Voices
    8. Clef
    9. Slurs and ties
    10. Meter
    11. Lenght
    12. Tempo
    13. Decorations
    14. Extended fields

1. Introduction

  This section describe the syntax recognized by ABCp. It assumes prior knowledge of ABC syntax and highlights only the relevant differences.


2.File structure

  The order in which the fields X: and K: appear is no longer mandatory so that the following two fragments are equivalent.

X:1
T:Goodbye
K:C
ABCD | EFGa

T:Goodbye
K:C
X:1
ABCD | EFGa


3.Notes

Pitch 

 

Ten octaves supported.
"Middle C" is C4 noted as "C"
Pitch ranges from A,,,, to g'''' (A0 to G9)
Equivalence is supported so that C' == c and a',,' == a

   

Accidentals 

Also "suggested" accidentals are supported:
(^)C or (=)a'

   

Microtones 

Accidentals may be followed by a fraction to signify microtones:

^1/2C means a pitch that is halfway between C and ^C, ^3/4C is halfway between ^C and D and is equivalent to _1/2D

As customary ^/C is equivalent to ^1/2C and ^//C to ^1/4C

   

Duration 

The note duration is expressed as a fraction of the default note length:

C1/2

Both numerators and denominators are in the range 1 .. 255


4. Fields

K: 
V: 
M: 
L: 
Q: 

Covered in "Key" section
Covered in "Voice" section
Covered in "Metric" section
Covered in "Length" section
Covered in "Tempo" section

   

A: 
O: 
C: 
D: 
Z: 

Field will be split in a list of strings. For example:

A: author1, author2, author3

strs[0] = "author1"
strs[1] = "author2"
strs[2] = "author3"
strs[3] = NULL

   

H: 

 

Multiline history field is recognized:

H: This reel was found
in an attic long time ago

   

Others 

 

All other fields are considered strings:

B: The definitive reels book

strs[0] = "The definitive reels book"
strs[1] = NULL

   

[*:] 

 

Fields in the middle of tunes (for example: [P:A]) are treated exactly as they where at the beginning of a line, the only difference is simply that they are marked as "internal".


5. Line continuations

'\' 

Lines can be "continued" placing a "\" at the end of the line.
This is implemented as it is customary in programming language. The following lines are equivalent

B: The definitive reels book

B: The definitive \
reels book

   

T_CONTINUE 

In tunes continuation is reported as a "T_CONTINUE" token.

In fields they are handled transparently:

V:P1 name="flute" clef=treble

V:P1 name="flute"\
          clef=treble

   

Fields 

 

In ABC 1.6, continuations were used to have changes occurring in the middle of a tune:

Ab Cd | \
M:2/4
Ef

ABCp considers the fragment above as equivalent to:

Ab Cd | [M:2/4] \
Ef


6. Keys

Tonic 

 

Any pitch possibly followed by "#" for sharp or "b" for flat (K:F#)
HP for Highland pipes
Hp or hp for Highland pipes
none for no key.

   

Mode 

maj or M

Major

min or m

Minor

mix

Mixolidean

dor

doric

phr

Phrygean

lyd

Lydean

loc

Locridean

ion

Ionic

aeo

Aeolic

exp

Explict.
Accidentals may be added using the "exp" key:

K:C exp ^F

Also "#" and "b" are supported:

K:C exp F#

"exp" is optional.
 

   

Clef 

See "Clef" section


7. Voice

ID 

Voice ID may be up to 32 characters long.

   

Clef 

See "Clef" Section


8. Clef

  Note that all the "=" signes are optional.

clef 

 

The "clef=" is optional except for C,F and G. All keys are case sensitive!

The recognized clefs are:

treble
alto
bass

The main clefs. They may be followed by a number to indicate on which line they should be printed 

K:C bass5

 

french
frenchviolin
violin
soprano
mezzo
mezzosoprano
tenor
baritone
subbass

 

treble1
treble1
treble2
alto1
alto2
alto2
alto4
alto5
bass5

 

perc
drum

Percussion clef

 

none

No clef

 

Doh or doh
Fa or fa

Gregorian Clefs

 

C
F
G

alto
bass
treble

Only after "clef="

V:1 clef=F

   

Transpose 

Transposition can be specified in a short form or with the "octave" and "transpose" keywords.

+22 -22

three octaves

+15 -15

two octaves

+8 -8

one octave

octave
o

transpose by the specified octaves

V:1 octave=-1

transpose
t

 

transpose by the specified semitones

t=+2

   

Tablature 

The following tablature clefs are recognized (abctab2ps)

frenchtab
french4tab
french5tab
guitartab
spanishtab
spanish4tab
spanish5tab
banjo4tab
banjo5tab
ukuleletab
italiantab
italian4tab
italian5tab
italian7tab
italian8tab

Explicit tablature with:

tab=<strings pitch>

tab=eBGDAE,

   

Voice names 

The two names togheter cannot be longer than 200 chars.

name
nm

The "long" name

subname
shortname
snm

The "short" name

  V:T1 name="Main Tenor" snm="T.I"

   

Stafflines 

The number of lines in the staff:

K:perc stafflines=1

Short form is "s"

   

Middle 

The pitch of the middle line in the staff.

K:none stafflines=3 middle=G

Short form is "m"

   

Stems direction 

Stem directions for notes and grace notes can be specified.

stems
stem

Direction for note stems

gstems
gstem

Direction for grace note stems

K:C stems=up gstems=down

   

Grouping 

The extensions used by abctab2ps are recognized:

staves
stv
 

The next n-1 staves will be connected to this one with a bar

brace
brc
 

The next n-1 staves will be connected to this one with a curly brace

bracket
brk

The next n-1 staves will be connected to this one with a bracket

   

Staff spacing 

Modify vertical space between this staff and the one below

K:C space=+20

Short form is "spc"


9. Slurs and ties

Direction 

 

To force the direction of a slur or a tie the "'" and "," characters may be used:

A2('BC-, | CD2)E

The tie should be drawn below and the slur above.


10. Meter

Compound 

 

Compound meters are supported in the following forms:

M:2+3+3/8
M:2 3 3/8  

   

Parenthesis 

Parenthesis can be specified in the following ways:

M:(3/4)
M:(3)/4
M:3/(4)

  

   

Old meter 

Denominator may be omitted to specify ancient meters:

M:3

 


11. Length

Symbolic 

 

The default length may also be specified using a symbolic name:

L:doublewhole

L:2

L:whole

L:1

L:half

L:1/2

L: quarter

L:1/4

L:eighth

L:1/8

L:sixteenth

L:1/16

L:thirtysecond

L:1/32

L:sixtyfourth

L:1/64

L:onetwentyeighth

L:1/128


12. Tempo

Single number 

 

Meaning: play 120 unit note-lengths per minute.

Q:120

 

   

Beats 

Number of beats per minute:

Q:5/4=40
Q:1/4 3/8 1/4 3/8=40

   

1.6 syntax 

The old ABC syntax is recognized:

Q:C3=120
Q:C=120

   

String 

 

A string may be specified at the begininning or at the end. It must be enclosed in quotes. There can be only one string.:

Q:"Andante" 1/4=120
Q:1/4=120 "Andante"


13. Decorations

  The set of decoration has been greatly extended trying to incorporate elements from other notations systems (CMN, PMW, MUP, Lylipond). Also synonims have been included (for example +pp+ and +pianissimo+ are equivalent).

'+' and '!' 

Both formats for decorations are recognized so that all the following forms are equivalent:

!trill! +trill+ T !T! +T+

   

Dynamics 

pppp pianissississimo
ppp  pianississimo
pp   pianissimo
p    piano
mp   mezzopiano
mf   mezzoforte
f    forte
ff   fortissimo
fff  fortississimo
ffff fortissississimo
fp   fortepiano
sfz  fz sforzando
rfz  rf rinforzando
sfp  sforzandopiano 
niente n
sffff  subitoffff subitofortissississimo
sfff   subitofff  subitofortississimo
sff    subitoff   subitofortissimo
sf     subitof    subitoforte
smf    subitomf   subitomezzoforte
smp    subitomp   subitomezzopiano
sp     subitop    subitopiano
spp    subitopp   subitopianissimo
sppp   subitoppp  subitopianississimo
spppp  subitopppp subitopianissississimo
crescendo(  <(
crescendo)  <)
diminuendo( >(
diminuendo) >)
glissando(  g(
glissando)  g)
glissando   g     
   

Fingering 

 

1
2
3
4
5
arpeggio
arpeggioup
arpeggiodown
arrow
arrowup
arrowdown
noarpeggio 
H.O. hammeringon
P.O. pulloff
SL.  sliding
W.   wham
   

Articulation 

accent   >   L    emphasis
marcato
staccatissimo
staccato .
tenuto
portato
upbow
downbow
flageolet
thumb
lheel
rheel
ltoe
rtoe
open
stopped
turn
reverseturn  invertedturn
trill        tr   T
prall
mordent      lowermordent  M
prallprall
prallmordent
upprall
downprall
upmordent    uppermordent P  pralltriller
downmordent  
pralldown
prallup
lineprall
signumcongruentiae
slide J
turnx
reverseturnx   invertedturnx
trill(    tr(
trill)    tr)
roll ~ irishroll
   

Pedaling 

 

Explicit pedal for piano has been included

damppedal ped 
sostpedal mped
softpedal lped

damppedal) ped) 
sostpedal) mped)
softpedal) lped)

damppedal( ped( 
sostpedal( mped( 
softpedal( lped(
   

Misc 

segno   S
coda    O
D.S.
D.C. 
dacoda
dacapo
dalsegno
fine
varcoda
shortphrase
mediumphrase
longphrase
8va(
8va)
8vab(
8vab)
beamon
gmark
invisible
shead
xhead
chead
dhead
sfhead
xfhead
cfhead
dfhead
shead(
xhead(
chead(
dhead(
sfhead(
xfhead(
cfhead(
dfhead(
shead)
xhead)
chead)
dhead)
sfhead)
xfhead)
cfhead)
dfhead)
stemup
stemdown
stemup(
stemdown(
stemup)
stemdown)
X
   

Pause 

breath ,
fermata      hold       H
shortfermata
longfermata
verylongfermata
generalpause G.P.
caesura pause rr //
reversefermata invertedfermata ufermata udfermata
grandpause
   

Instrument 

 

The entire set of GM Midi instrument is recognized

Mute
AcousticGrandPiano
BrightAcousticPiano
ElectricGrandPiano
HonkyTonkPiano
ElectricPiano1
ElectricPiano2
Harpsichord
Clavi
Celesta
Glockenspiel
MusicBox
Vibraphone
Marimba
Xylophone
TubularBells
Dulcimer
DrawbarOrgan
PercussiveOrgan
RockOrgan
ChurchOrgan
ReedOrgan
Accordion
Harmonica
TangoAccordion
AcousticGuitarNylon
AcousticGuitarSteel
ElectricGuitarJazz
ElectricGuitarClean
ElectricGuitarMuted
OverdrivenGuitar
DistortionGuitar
Guitarharmonics
AcousticBass
ElectricBassFinger
ElectricBassPick
FretlessBass
SlapBass1
SlapBass2
SynthBass1
SynthBass2
Violin
Viola
Cello
Contrabass
TremoloStrings
PizzicatoStrings
OrchestralHarp
Timpani
StringEnsemble1
StringEnsemble2
SynthStrings1
SynthStrings2
ChoirAahs
VoiceOohs
SynthVoice
OrchestraHit
Trumpet
Trombone
Tuba
MutedTrumpet
FrenchHorn
BrassSection
SynthBrass1
SynthBrass2
SopranoSax
AltoSax
TenorSax
BaritoneSax
Oboe
EnglishHorn
Bassoon
Clarinet
Piccolo
Flute
Recorder
PanFlute
BlownBottle
Shakuhachi
Whistle
Ocarina
LeadSquare
LeadSawtooth
LeadCalliope
LeadChiff
LeadCharang
LeadVoice
LeadFifths
LeadBassLead
PadNewage
PadWarm
PadPolysynth
PadChoir
PadBowed
PadMetallic
PadHalo
PadSweep
FXRain
FXSoundtrack
FXCrystal
FXAtmosphere
FXBrightness
FXGoblins
FXEchoes
FXSciFi
Sitar
Banjo
Shamisen
Koto
Kalimba
Bagpipe
Fiddle
Shanai
TinkleBell
Agogo
SteelDrums
Woodblock
TaikoDrum
MelodicTom
SynthDrum
ReverseCymbal
GuitarFretNoise
BreathNoise
Seashore
BirdTweet
TelephoneRing
Helicopter
Applause
Gunshot
   

Percussions 

 

The set of MIDI unpitched percussions (plus some others) is recognized

gong
triangle
halfopenhihat
hardstick
softstick
metalstick
rubberstick
trianglestick
wirebrush
woodstick
tinklebell
agogo
steeldrums
woodblock
taikodrum
melodictom
synthdrum
reversecymbal
acousticbassdrum
bassdrum1
sidestick
acousticsnare             snare
handclap
electricsnare
lowfloortom
closedhihat               hihat
highfloortom  
pedalhihat
lowtom
openhihat
lowmidtom
himidtom
crashcymbal1              cymbal
hightom
ridecymbal1
chinesecymbal
ridebell
tambourine
splashcymbal
cowbell
crashcymbal2
vibraslap
ridecymbal2
hibongo
lowbongo
mutehiconga
openhiconga
lowconga
hightimbale
lowtimbale
highagogo
lowagogo
cabasa
maracas
shortwhistle
longwhistle
shortguiro
longguiro
claves
hiwoodblock
lowwoodblock
mutecuica
opencuica
mutetriangle
opentriangle        

14. Extended fields

None 

 

begintext
endtext
newpage
vskip

   

String 

center
text
abc-copyright
abc-version
abc-creator
abc-charset
abc-include
abc-edited-by

   

Font, size 

annotationfont
composerfont
gchordfont
infofont
partsfont
subtitlefont
setfont-1
setfont-2
setfont-3
setfont-4
tempofont
textfont
titlefont
vocalfont
wordsfont

   

Length 

botmargin
composerspace
indent
infospace
leftmargin
musicspace
pageheight
pagewidth
partsspace
rightmargin
staffsep
subtitlespace
sysstaffsep
textspace
titlespace
topmargin
topspace
vocalspace
wordsspace

   

Logical  

continueall
exprabove
exprbelow
freegchord
musiconly
measurebox
graceslurs
infoline
landscape
oneperpage
printtempo
stretchlast
stretchstaff
vocalabove
withxrefs
writehistory

   

Number 

lineskipfac
maxshrink
parskipfac
sep
scale

   

Integer  

barnumbers
barsperstaff
measurefirst
measurenb
setbarnb

   

Misc  

midi
papersize
propagate-accidentals
score
staves
writeout-accidentals
deco
postscript