Mercurial > dottes
annotate makeHornInF.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 | 1a9d937b7765 |
children | 7b98278d6e8b |
rev | line source |
---|---|
216 | 1 #!/bin/bash |
2 # | |
3 # Transpose a book for Horn in F. | |
4 | |
5 if [ $# != 1 ]; then | |
6 echo "Usage: makeFHorn.sh <book dir name>" | |
7 exit 1 | |
8 fi | |
9 | |
10 dir=`pwd` | |
11 | |
12 booke=$dir/$1 | |
13 outdir=$dir/$1-HornInF | |
14 | |
15 mkdir -p $outdir | |
16 | |
217
a8a46fd79d5c
Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
216
diff
changeset
|
17 # Copy book component items. |
a8a46fd79d5c
Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
216
diff
changeset
|
18 cp $booke/*.txt $outdir |
a8a46fd79d5c
Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
216
diff
changeset
|
19 |
216 | 20 find $booke -name "*.abc" | sort | |
21 while read filename | |
22 do | |
23 name=`basename $filename .abc` | |
24 tmpfile=$outdir/$name.abc.tmp | |
25 | |
26 # Strip out guitar chords first. This has the advantage of removing | |
27 # text with arbitary lower case characters too. | |
28 sed -e "s/\"[^\"]*\"//g" $filename > $tmpfile | |
29 | |
30 # Transpose concert pitch up a fifth. | |
31 # If there are any notes at or above C above middle C, transpose | |
32 # down a seventh instead. | |
33 transpose=5 | |
34 if grep -v "^[A-Z]:" $tmpfile | sed -e 's/"[^"]*"//g' | grep -q "[a-g]"; then | |
35 transpose=-7 | |
36 fi | |
37 | |
38 # Transpose. By default abc2abc will report errors in the output, | |
218
1a9d937b7765
Force Horn in F output to be in treble clef.
Jim Hague <jim.hague@laicatc.com>
parents:
217
diff
changeset
|
39 # but this messes up output formatting so stop it. Also force all |
1a9d937b7765
Force Horn in F output to be in treble clef.
Jim Hague <jim.hague@laicatc.com>
parents:
217
diff
changeset
|
40 # output to be in treble clef; some lower tunes with the odd high |
1a9d937b7765
Force Horn in F output to be in treble clef.
Jim Hague <jim.hague@laicatc.com>
parents:
217
diff
changeset
|
41 # note will otherwise appear in bass clef, which is not what this |
1a9d937b7765
Force Horn in F output to be in treble clef.
Jim Hague <jim.hague@laicatc.com>
parents:
217
diff
changeset
|
42 # crap horn player wants. |
1a9d937b7765
Force Horn in F output to be in treble clef.
Jim Hague <jim.hague@laicatc.com>
parents:
217
diff
changeset
|
43 abc2abc $tmpfile -e -t $transpose | \ |
1a9d937b7765
Force Horn in F output to be in treble clef.
Jim Hague <jim.hague@laicatc.com>
parents:
217
diff
changeset
|
44 sed -e "/^ *K:/s/$/ clef=treble/" > $outdir/$name.abc |
216 | 45 rm $tmpfile |
46 done |