# HG changeset patch # User Jim Hague # Date 1450046844 0 # Node ID cf2fe741a582929f789552d28560dd4e58231197 # Parent c0130d1ee053a0a94da33e8dded87f10c736fd99 Try Cello transposition algorithm again. diff -r c0130d1ee053 -r cf2fe741a582 makeCello.sh --- a/makeCello.sh Sun Dec 13 22:46:55 2015 +0000 +++ b/makeCello.sh Sun Dec 13 22:47:24 2015 +0000 @@ -17,22 +17,24 @@ # octave. $2 is highest note, $3 is lowest note. # # If range is G to d', transpose down 2 octaves. -# If lowest note is < C, transpose down 1 octave. # Otherwise calculate the distance above d for the highest note on a one -# octave transposition, and the distance below G on a two octave +# octave transposition, and the distance below C on a two octave # transposition. Find the smallest, and use the corresponding -# transposition. +# transposition, preferring 2 octaves in case of a tie. transposedowntwo() { if (($3 >= 104 && $2 <= 115)); then return 0; fi - if (($3 < 100)); then - return 1; + over=$(($2 - 108)) + if (($over < 0)); then + over=0 fi - over=$(($2 - 108)) - under=$((104 - $3)) - if (($over <= $under)); then + under=$((100 - $3)) + if (($under < 0)); then + under=0 + fi + if (($over < $under)); then return 1; fi