Melodeon.net Forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the new melodeon.net forum

Pages: [1]   Go Down

Author Topic: abcpp  (Read 1034 times)

0 Members and 1 Guest are viewing this topic.

Mike Hirst

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1325
  • Primatona IV D/D#, Black Dot B/C, One Row in D
abcpp
« on: June 10, 2019, 12:04:17 PM »

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.

Code: [Select]
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.

Code: [Select]
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.

Code: [Select]
#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
Code: [Select]
X:xref
T:title
C:composer
R:rhythm
L:length
M:meter
K:key

Code: [Select]
#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.

Code: [Select]
#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.

Code: [Select]
#define "c/B/" "c"


And one awkward run down that I choose to ignore.

Code: [Select]
#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:

Code: [Select]
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.

Code: [Select]
#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:

Code: [Select]
# ====================================
# 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|]
« Last Edit: June 10, 2019, 04:37:52 PM by Mike Hirst »
Logged
"Slip like Freudian, your first and last step to playing yourself like an Accordion" - MF DOOM - Madvillain

Gena Crisman

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1044
  • 🇬🇧
Re: abcpp
« Reply #1 on: June 13, 2019, 05:30:58 PM »

Hello,

Just want to say, I both understand and appreciate the value and utility of this information, and I wasn't aware of it before, so, I'd like to thank you for posting it.

So: Thanks!
Logged

Mike Hirst

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1325
  • Primatona IV D/D#, Black Dot B/C, One Row in D
Re: abcpp
« Reply #2 on: June 14, 2019, 12:27:41 AM »

Hello,

Just want to say, I both understand and appreciate the value and utility of this information, and I wasn't aware of it before, so, I'd like to thank you for posting it.

So: Thanks!

One of the things I have not emphasised in the text above is the possibility for passing values at the command line. For example I have a standard abc file header. With a single line command I can set up a new abc file complete with note length, title, time sig. etc. Not only does this save time, but it stops me from making silly mistakes and forces a standard format/layout, which makes editing easier.

Guido Gonzato's tool is very well written and is not limited to abc usage. The one drawback is that it does not allow nested directives. I have found that the python project preprocessor.py can be used to work with abc files. The main problem here is that the python tool does not recognize the abc file extension. The workaround here is to present the abc data as a plain text (txt) file. It is also possible to hack the python code to include the abc extension.
Logged
"Slip like Freudian, your first and last step to playing yourself like an Accordion" - MF DOOM - Madvillain
Pages: [1]   Go Up
 


Melodeon.net - (c) Theo Gibb; Clive Williams 2010. The access and use of this website and forum featuring these terms and conditions constitutes your acceptance of these terms and conditions.
SimplePortal 2.3.5 © 2008-2012, SimplePortal