Mercurial > dottes
comparison makeCello.sh @ 349:1073829494e3
Try to be cleverer when transposing for cello.
Jane says: Am most comfortable between the bottom G (the bottom line of the bass clef) and top D (the note above middle C), but can play from bottom C upwards (the C string is a bit growly) and at a push can get as high as the A above middle C.
Implement the following rule:
1. If range is G to d', transpose down 2 octaves.
2. If lowest note is < C, transpose down 1 octave.
3. Otherwise calculate the distance above d for the highest note on a one
octave transposition, and the distance below G on a two octave
transposition. Find the smallest, and use the corresponding
transposition.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Tue, 13 Aug 2013 00:51:43 +0100 |
parents | b4a0161e8870 |
children | cf2fe741a582 |
comparison
equal
deleted
inserted
replaced
348:b8ea9cfb3546 | 349:1073829494e3 |
---|---|
11 if [ $# != 1 ]; then | 11 if [ $# != 1 ]; then |
12 echo "Usage: makeCello.sh <book dir name>" | 12 echo "Usage: makeCello.sh <book dir name>" |
13 exit 1 | 13 exit 1 |
14 fi | 14 fi |
15 | 15 |
16 # Transpose down (return 0) if bottom note was < C. | 16 # Return 0 if we should transpose down 2 octaves, 1 if just one |
17 # octave. $2 is highest note, $3 is lowest note. | |
18 # | |
19 # If range is G to d', transpose down 2 octaves. | |
20 # If lowest note is < C, transpose down 1 octave. | |
21 # Otherwise calculate the distance above d for the highest note on a one | |
22 # octave transposition, and the distance below G on a two octave | |
23 # transposition. Find the smallest, and use the corresponding | |
24 # transposition. | |
17 transposedowntwo() | 25 transposedowntwo() |
18 { | 26 { |
19 return $(($3 >= 100)) | 27 if (($3 >= 104 && $2 <= 115)); then |
28 return 0; | |
29 fi | |
30 if (($3 < 100)); then | |
31 return 1; | |
32 fi | |
33 over=$(($2 - 108)) | |
34 under=$((104 - $3)) | |
35 if (($over <= $under)); then | |
36 return 1; | |
37 fi | |
38 | |
39 return 0; | |
20 } | 40 } |
21 | 41 |
22 dir=`pwd` | 42 dir=`pwd` |
23 | 43 |
24 booke=$dir/$1 | 44 booke=$dir/$1 |
36 do | 56 do |
37 name=`basename $filename .abc` | 57 name=`basename $filename .abc` |
38 range=`./abcrange.py $filename` | 58 range=`./abcrange.py $filename` |
39 | 59 |
40 # Move down either one octave or two, depending on the range | 60 # Move down either one octave or two, depending on the range |
41 # of the tune. If there are any notes below middle C, transpose | 61 # of the tune. |
42 # down one octave. The default is to transpose down two octaves. | 62 middle="D" |
43 middle="d" | |
44 if transposedowntwo $range; then | 63 if transposedowntwo $range; then |
45 middle="D" | 64 middle="d" |
46 fi | 65 fi |
47 | 66 |
48 sed -e "/^ *K:/s/$/ clef=bass middle=$middle/" $filename > $outdir/$name.abc | 67 sed -e "/^ *K:/s/$/ clef=bass middle=$middle/" $filename > $outdir/$name.abc |
49 done | 68 done |