Further to me recent
post re ossia staves in which I briefly describe using abcpp as a preprocessing tool, I thought that it might be useful to give a more detailed example illustrating usage.
In teaching I recently transcribed my version of the slow air Swindon. Composed by Northumbrian shepherd Archie Dagg the tune is named after the small village where he lived after retiring. I learned the tune in the key of F so that I could duet with Northumbrian pipes.
Here is my transcription of the tune as played on Northumbrian pipes.
X:1
T:Swindon
C:Archie Dagg
R:slow air
L:1/4
M:3/4
K:F
c/B/|A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|c>FA|G2c/B/|
A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|F>GE|F2c|
fcf|e>ce|dBd|c2F|\
F>Ac|cFA|cFA|G2(3c/d/e/|
fcf|e>ce|dBd|c2B/A/|\
B>cd|cAF|CEG|F2x|]
In order to play this on C one row I had to slightly alter some bars to avoid the Bb which I do not have.
X:1
T:Swindon
C:Archie Dagg (arr. Mike Hirst)
R:slow air
L:1/4
M:3/4
K:F
c/B/|A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|c>FA|G2c/B/|
A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|F>GE|F2c|
fcf|e>ce|dBd|c2F|\
F>Ac|cFA|cFA|G2(3c/d/e/|
fcf|e>ce|dBd|c2B/A/|\
B>cd|cAF|CEG|F2x|]
Played over the standard pipe arrangement this makes a good duet and sits stylistically very well within the genre.
In preparing these transcriptions I used the abc preprocessor
abcpp. I started by copying the standard transcription to a new file. To differntiate this from the source I chose to name the file swindon.p.abc. The p indicating that this is a file intended for preprocessing. Others use the file extension .abp. This is personal preference.
In the first instance I have separated the information fields from the transcription. I have written these as directives. The preprocessor will insert the info at the correct place at compilation.
#define xref "1"
#define title "Swindon"
#define composer "Archie Dagg"
#define rhythm "slow air"
#define length "1/4"
#define meter "3/4"
#define key "F"
X:xref
T:title
C:composer
R:rhythm
L:length
M:meter
K:key
c/B/|A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|c>FA|G2c/B/|
A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|F>GE|F2c|
fcf|e>ce|dBd|c2F|\
F>Ac|cFA|cFA|G2(3c/d/e/|
fcf|e>ce|dBd|c2B/A/|\
B>cd|cAF|CEG|F2x|]
To keep things simple the tune header can be inserted using an external file. Let's call this header.p.abc
X:xref
T:title
C:composer
R:rhythm
L:length
M:meter
K:key
#define xref "1"
#define title "Swindon"
#define composer "Archie Dagg"
#define rhythm "slow air"
#define length "1/4"
#define meter "3/4"
#define key "F"
#include header.p.abc
c/B/|A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|c>FA|G2c/B/|
A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|F>GE|F2c|
fcf|e>ce|dBd|c2F|\
F>Ac|cFA|cFA|G2(3c/d/e/|
fcf|e>ce|dBd|c2B/A/|\
B>cd|cAF|CEG|F2x|]
In practice I have a more complicated header file which can be adpted to include additional info fields and with predefined fields include dates and other standard references.
Although those bars are repeated, there are really only three bars which need changing for the tune to fit on the C melodeon. I can make those substitutions by writing directives.
#define "dBG" "def"
#define "dBd" "dfd"
#define "B>cd" "d>ef"
In addition there are several places where Bb follows c at the start of a phrase.
#define "c/B/" "c"
And one awkward run down that I choose to ignore.
#define xref "1"
#define title "Swindon"
#define composer "Archie Dagg"
#define rhythm "slow air"
#define length "1/4"
#define meter "3/4"
#define key "F"
#define "dBG" "def"
#define "dBd" "dfd"
#define "B>cd" "d>ef"
#define "c/B/" "c"
#define "B/A/" "z"
#include header.p.abc
c/B/|A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|c>FA|G2c/B/|
A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|F>GE|F2c|
fcf|e>ce|dBd|c2F|\
F>Ac|cFA|cFA|G2(3c/d/e/|
fcf|e>ce|dBd|c2B/A/|\
B>cd|cAF|CEG|F2x|]
Running this at the command line "abcpp swindon.p.abc" will give this output:
X:1
T:Swindon
C:Archie Dagg
R:slow air
L:1/4
M:3/4
K:F
c|A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|def|c>FA|G2c|
A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|def|F>GE|F2c|
fcf|e>ce|dfd|c2F|\
F>Ac|cFA|cFA|G2(3c/d/e/|
fcf|e>ce|dfd|c2z|\
B>cd|cAF|CEG|F2x|]
All fine and dandy, but what if I want to go back to the original arrangement? To do this I can use a conditional directive.
#ifdef MH
#define "dBG" "def"
#define "dBd" "dfd"
#define "B>cd" "d>ef"
#define "c/B/" "c"
#define "B/A/" "z"
#endif
Now the substitutions will only be made if I include my initials in the command "apcpp -MH swindon.p.abc".
I find it useful to annotate code to make editing easier. The full code then, will look like this:
# ====================================
# meta (header)
# ====================================
#define xref "1"
#define title "Swindon"
#ifdef MH
#define composer "Archie Dagg (arr. Mike Hirst)"
#else
#define composer "Archie Dagg"
#endif
#define rhythm "slow air"
#define length "1/4"
#define meter "3/4"
#define key "F"
# ====================================
# substitutions
# ====================================
#ifdef MH
#define "dBG" "def"
#define "dBd" "dfd"
#define "B>cd" "d>ef"
#define "c/B/" "c"
#define "B/A/" "z"
#endif
#include header.p.abc
c/B/|A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|c>FA|G2c/B/|
A>GF|F>EF|FAf|d2(3c/d/e/|\
f>cA|dBG|F>GE|F2c|
fcf|e>ce|dBd|c2F|\
F>Ac|cFA|cFA|G2(3c/d/e/|
fcf|e>ce|dBd|c2B/A/|\
B>cd|cAF|CEG|F2x|]