Mercurial > dottes
annotate makeAltoRecorderCFingering.sh @ 710:e99a1b0ad869
Handle slows as per Banks of the Dee.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Sun, 08 Oct 2017 20:34:07 +0100 |
parents | 2f6e05d0aba0 |
children | ce5c7214f9aa |
rev | line source |
---|---|
216 | 1 #!/bin/bash |
2 # | |
671
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
3 # Transpose a book for alto recorder with C fingering. |
216 | 4 |
5 if [ $# != 1 ]; then | |
671
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
6 echo "Usage: makeAltoRecorderCFingering.sh <book dir name>" |
216 | 7 exit 1 |
8 fi | |
9 | |
671
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
10 # Transpose up (return 0) if bottom note was < F (< C for recorder). |
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
11 transposeup() |
322
b4a0161e8870
Add abcrange.py to return the range of a tune, and use it in instrument transposition.
Jim Hague <jim.hague@acm.org>
parents:
263
diff
changeset
|
12 { |
671
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
13 (($3 < 103)) |
322
b4a0161e8870
Add abcrange.py to return the range of a tune, and use it in instrument transposition.
Jim Hague <jim.hague@acm.org>
parents:
263
diff
changeset
|
14 } |
b4a0161e8870
Add abcrange.py to return the range of a tune, and use it in instrument transposition.
Jim Hague <jim.hague@acm.org>
parents:
263
diff
changeset
|
15 |
216 | 16 dir=`pwd` |
17 | |
18 booke=$dir/$1 | |
671
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
19 outdir=$dir/$1-AltoRecorderCFingering |
216 | 20 |
21 mkdir -p $outdir | |
22 | |
217
a8a46fd79d5c
Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
216
diff
changeset
|
23 # Copy book component items. |
a8a46fd79d5c
Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
216
diff
changeset
|
24 cp $booke/*.txt $outdir |
a8a46fd79d5c
Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
216
diff
changeset
|
25 |
671
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
26 echo "Alto Recorder (C Fingering)" > $outdir/instrument.txt |
263
7b98278d6e8b
Add instrument name into title page for transpositions.
Jim Hague <jim.hague@acm.org>
parents:
218
diff
changeset
|
27 |
216 | 28 find $booke -name "*.abc" | sort | |
29 while read filename | |
30 do | |
31 name=`basename $filename .abc` | |
322
b4a0161e8870
Add abcrange.py to return the range of a tune, and use it in instrument transposition.
Jim Hague <jim.hague@acm.org>
parents:
263
diff
changeset
|
32 range=`./abcrange.py $filename` |
216 | 33 |
671
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
34 # Transpose concert pitch down a fifth. |
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
35 # If there are any notes below 'F' (recorder 'C'), transpose |
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
36 # up a seventh instead. |
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
37 transpose=-5 |
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
38 if transposeup $range; then |
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
39 transpose=7 |
216 | 40 fi |
41 | |
370
ecc62b487e57
Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents:
351
diff
changeset
|
42 # There's no point in having transposed chords. Remove from the |
ecc62b487e57
Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents:
351
diff
changeset
|
43 # abc before transposing. Some badly formed chord items can give |
ecc62b487e57
Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents:
351
diff
changeset
|
44 # erroneous output from abc2abc (like, strings of binary gibberish). |
ecc62b487e57
Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents:
351
diff
changeset
|
45 sed -e "s/\"[^\"]*\"//g" $filename > $outdir/$name.abc.tmp |
ecc62b487e57
Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents:
351
diff
changeset
|
46 |
216 | 47 # Transpose. By default abc2abc will report errors in the output, |
671
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
48 # but this messes up output formatting so stop it. |
2f6e05d0aba0
Add experimental Alto Recorder (C Fingering) instrument.
Jim Hague <jim.hague@acm.org>
parents:
370
diff
changeset
|
49 abc2abc $outdir/$name.abc.tmp -e -t $transpose > $outdir/$name.abc |
370
ecc62b487e57
Some empty "" chords may be causing trouble with Jenkins.
Jim Hague <jim.hague@acm.org>
parents:
351
diff
changeset
|
50 rm $outdir/$name.abc.tmp |
216 | 51 done |