annotate makeCello.sh @ 241:3524e3b007bb

Revise chords to some that make sense on a guitar. Also remove unplayed [2 at the end of the A tune.
author Jim Hague <jim.hague@acm.org>
date Thu, 06 Jun 2013 20:58:14 +0100
parents 3c9d9654d4a1
children 7b98278d6e8b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
155
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
1 #!/bin/bash
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
2 #
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
3 # Copy a booke to cello-friendly form. Bass clef, transposed down 2 octaves.
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
4 #
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
5 # It would be easier to do with transpose in dottes.fmt, but I can't get
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
6 # that to work properly for a 2 octave downward transpose.
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
7 #
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
8 # This relies on abcm2ps >= 6.0 but does not check for it.
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
9
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
10 if [ $# != 1 ]; then
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
11 echo "Usage: makeCello.sh <book dir name>"
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
12 exit 1
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
13 fi
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
14
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
15 dir=`pwd`
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
16
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
17 booke=$dir/$1
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
18 outdir=$dir/$1-Cello
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
19
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
20 mkdir -p $outdir
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
21
197
8f352063f277 Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents: 188
diff changeset
22 # Copy book component items.
8f352063f277 Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents: 188
diff changeset
23 cp $booke/*.txt $outdir
8f352063f277 Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents: 188
diff changeset
24
155
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
25 find $booke -name "*.abc" | sort |
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
26 while read filename
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
27 do
188
76f18e0a80bd Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents: 155
diff changeset
28 # Move down either one octave or two, depending on the range
76f18e0a80bd Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents: 155
diff changeset
29 # of the tune. If there are any notes below middle C, transpose
76f18e0a80bd Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents: 155
diff changeset
30 # down one octave. The default is to transpose down two octaves.
76f18e0a80bd Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents: 155
diff changeset
31 middle="d"
76f18e0a80bd Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents: 155
diff changeset
32 if grep -v "^[A-Z]:" $filename | sed -e 's/"[^"]*"//g' | grep -q "[A-Z],"; then
76f18e0a80bd Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents: 155
diff changeset
33 middle="D"
76f18e0a80bd Have a go at being slightly more intelligent in the cello transposition.
Jim Hague <jim.hague@acm.org>
parents: 155
diff changeset
34 fi
155
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
35 name=`basename $filename .abc`
215
3c9d9654d4a1 Add 'clef=bass' into the converted output.
Jim Hague <jim.hague@laicatc.com>
parents: 197
diff changeset
36 sed -e "/^ *K:/s/$/ clef=bass middle=$middle/" $filename > $outdir/$name.abc
155
cc2d4925f280 Produce a cello-friendly Booke.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
37 done