Skip to content

Commit

Permalink
Rework dulcimer versions to omit tabs for tunes not in 'D'
Browse files Browse the repository at this point in the history
The dulcimer tabs correctly represented all the melodies, but playing
tunes in keys other then 'D' would be unsatisfactory because the drone
strings would be out of tune.

There's no easy fix for this. Pro-tem, this fix removes the tabs from
the existing Dulcimer tunebook (just leaving the cords), and creates
a new version with both chords and tabs but just for tunes in 'D'.

To do this, sorter.py was enhanced with the ability to filter tunes
based on the K: header.
  • Loading branch information
Jon Warbrick committed Aug 29, 2019
1 parent 6f78d95 commit ca97246
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 14 deletions.
29 changes: 22 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dist/tunebook-baseclef.pdf \
dist/tunebook-tabs.pdf \
dist/tunebook-mandolin.pdf \
dist/tunebook-dulcimer.pdf \
dist/tunebook-dulcimer-tabs-dad.pdf \
dist/tunebook-ukulele.pdf \
dist/cheatsheet.pdf \
dist/cheatsheet-whistle.pdf \
Expand Down Expand Up @@ -117,15 +118,28 @@ dist/tunebook-mandolin.pdf : $(abc_source) mandolin.abc frontmatter.abc bin/sort
exiftool -Title='Tunebook ABC - Mandolin' -Author='Tunebook ABC' $@

# All the tunes as a printable score, one tune per page with dulcimer
# chord diagrams and dulcimer tabs
dist/tunebook-dulcimer.pdf : $(abc_source) dulcimer.abc frontmatter.abc bin/sorter.py bin/add_chords.py tunebook.fmt dulcimer.fmt dulcimerchords.fmt
# chord diagrams for a DAD-tuned instrument
dist/tunebook-dulcimer.pdf : $(abc_source) dulcimer-chords-dad.abc frontmatter.abc bin/sorter.py bin/add_chords.py tunebook.fmt dulcimer.fmt dulcimerchords.fmt
mkdir -p dist
(echo '%abc-2.1'; \
cat dulcimer.abc; echo; echo; \
cat dulcimer-chords-dad.abc; echo; echo; \
cat frontmatter.abc; echo; echo; \
echo "%%header \"-$$(git describe --tags --always) \$$P\""; echo; \
echo '%%newpage'; \
bin/sorter.py --ref; \
) | bin/add_chords.py | abcm2ps - -1 -i -F tunebook.fmt -F dulcimerchords.fmt -O - | ps2pdf - $@
exiftool -Title='Tunebook ABC - DAD Dulcimer Chords' -Author='Tunebook ABC' $@

# Just the tunes in 'D' as a printable score, one tune per page with dulcimer
# chord diagrams and dulcimer tabs for a DAD-tuned instrument
dist/tunebook-dulcimer-tabs-dad.pdf : $(abc_source) dulcimer-tabs-dad.abc frontmatter.abc bin/sorter.py bin/add_chords.py tunebook.fmt dulcimer.fmt dulcimerchords.fmt
mkdir -p dist
(echo '%abc-2.1'; \
cat dulcimer-tabs-dad.abc; echo; echo; \
cat frontmatter.abc; echo; echo; \
echo "%%header \"-$$(git describe --tags --always) \$$P\""; echo; \
echo '%%newpage'; \
bin/sorter.py --ref --key-filter D; \
) | bin/add_chords.py | abcm2ps - -1 -i -F tunebook.fmt -F dulcimerchords.fmt -T8 -O - | ps2pdf - $@
exiftool -Title='Tunebook ABC - Dulcimer' -Author='Tunebook ABC' $@

Expand Down Expand Up @@ -179,15 +193,16 @@ dist/cheatsheet-mandolin.pdf : $(abc_source) cheatsheet-mandolin.abc frontmatter
) | bin/make_cheatsheet.py --rows 8 | abcm2ps - -i -F tunebook.fmt -F cheatsheet.fmt -F cheatsheet-mandolin.fmt -T7 -O - | ps2pdf - $@
exiftool -Title='Tunebook ABC - Cheatsheet Mandolin' -Author='Tunebook ABC' $@

# The first few bars of all the tunes with dulcimer fingering
dist/cheatsheet-dulcimer.pdf : $(abc_source) cheatsheet-dulcimer.abc frontmatter.abc bin/sorter.py bin/make_cheatsheet.py tunebook.fmt cheatsheet.fmt cheatsheet-dulcimer.fmt dulcimer.fmt
# The first few bars of all the tunes in 'D' with dulcimer fingering for a
# DAD-tuned instrument
dist/cheatsheet-dulcimer.pdf : $(abc_source) cheatsheet-dulcimer-dad.abc frontmatter.abc bin/sorter.py bin/make_cheatsheet.py tunebook.fmt cheatsheet.fmt cheatsheet-dulcimer.fmt dulcimer.fmt
mkdir -p dist
(echo '%abc-2.1'; \
cat cheatsheet-dulcimer.abc; echo; echo; \
cat cheatsheet-dulcimer-dad.abc; echo; echo; \
cat frontmatter.abc; echo; echo; \
echo "%%header \"-$$(git describe --tags --always) \""; echo; \
echo '%%scale 0.6'; \
bin/sorter.py --title; \
bin/sorter.py --title --key-filter D; \
) | bin/make_cheatsheet.py --rows 8 | abcm2ps - -i -F tunebook.fmt -F cheatsheet.fmt -F cheatsheet-dulcimer.fmt -T8 -O - | ps2pdf - $@
exiftool -Title='Tunebook ABC - Cheatsheet Dulcimer' -Author='Tunebook ABC' $@

Expand Down
9 changes: 9 additions & 0 deletions bin/sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
group.add_argument('--ref', action='store_true')
group.add_argument('--title', action='store_true')
parser.add_argument('--paginate', action='store_true')
parser.add_argument('--key-filter')
args = parser.parse_args()

X_match = re.compile(r'^X:\s*(.*?)$', flags=re.MULTILINE)
T_match = re.compile(r'^T:\s*(.*?)$', flags=re.MULTILINE)
K_match = re.compile(r'^K:\s*(.*?)$', flags=re.MULTILINE)

songs = []
current_page = None
Expand All @@ -37,11 +39,18 @@
songs.append({'key': key, 'data': data})

for song in sorted(songs, key=lambda song: song['key']):

if args.key_filter:
match = K_match.search(song['data'])
if match.group(1) != args.key_filter:
continue

if args.ref and args.paginate:
this_page = song['key'][:3]
if current_page and current_page != this_page:
print('%%newpage')
print()
current_page = this_page

print(song['data'])
print()
4 changes: 2 additions & 2 deletions cheatsheet-dulcimer.abc → cheatsheet-dulcimer-dad.abc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
%%vskip 1.5cm
%%textfont * 36
%%center Tunebook ABC - Dulcimer CheatSheet
%%center Tunebook ABC - DAD Mountain Dulcimer CheatSheet
%%vskip 27

%%textfont * 18
%%vskip 5
%%begintext justify
%%This rendering of the tunebook is a 'CheatSheet' that shows
%%the first couple of bars of each tune along with Dulcimer tabs
%%the first couple of bars of the tunes in the key of 'D' along with Dulcimer tabs
%%to make it easier to find or remember how to play a particular tune.
%%endtext
6 changes: 3 additions & 3 deletions dulcimer.abc → dulcimer-chords-dad.abc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
%%vskip 1.5cm
%%textfont * 36
%%center Tunebook ABC - DAD Mountain Dulcimer
%%center Tunebook ABC - DAD Mountain Dulcimer Chords
%%vskip 27

%%textfont * 18
%%vskip 5
%%begintext justify
%%This rendering of the tunebook includes example chord diagrams and simple
%%melody tabs for DAD-tuned Mountain Dulcimers. The chords assume an instrument
%%This rendering of the tunebook includes example chord diagrams
%%for DAD-tuned Mountain Dulcimers. The chords assume an instrument
%%without a "1 1/2" fret (there are otherwise better fingerings for "C").
%%endtext
14 changes: 14 additions & 0 deletions dulcimer-tabs-dad.abc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%%vskip 1.5cm
%%textfont * 36
%%center Tunebook ABC - DAD Mountain Dulcimer TABs
%%vskip 27

%%textfont * 18
%%vskip 5
%%begintext justify
%%This rendering of the tunebook includes example chord diagrams and simple
%%melody tabs for DAD-tuned Mountain Dulcimers for all the tunes in the
%%key of 'D' (tunes in other keys would need retuning or clever capo tricks).
%%The chords assume an instrument
%%without a "1 1/2" fret (there are otherwise better fingerings for "C").
%%endtext
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ <h1>Tunebook ABC</h1>
<ul>
<li><a href="tunebook-tabs.pdf">tunebook-tabs.pdf</a> with guitar chord diagrams and D whistle tabs.</li>
<li><a href="tunebook-mandolin.pdf">tunebook-mandolin.pdf</a> with mandolin tabs.</li>
<li><a href="tunebook-dulcimer.pdf">tunebook-dulcimer.pdf</a> with example chord diagrams and
tabs of the melody for D-A-D mountain dulcimers.</li>
<li><a href="tunebook-dulcimer.pdf">tunebook-dulcimer.pdf</a> with example chord diagrams for D-A-D mountain dulcimers.</li>
<li><a href="tunebook-dulcimer-tabs-dad.pdf">tunebook-dulcimer-tabs-dad.pdf</a> with example chord diagrams and simple tabs just for the tunes in the key of 'D' for D-A-D mountain dulcimers (tunes in other keys would need retuning or clever capo tricks).</li>
<li><a href="tunebook-ukulele.pdf">tunebook-ukulele.pdf</a> with ukulele chord diagrams.</li>
</ul></li>
<li>A compact index to all the tunes, just showing the first couple of bars
Expand Down

0 comments on commit ca97246

Please sign in to comment.