comparison makeCello.sh @ 538:e9e2488bd0b7 build-default-226

Automated merge with ssh://hg.cryhavoc.org.uk/dottes
author Jim Hague <jim.hague@acm.org>
date Sun, 13 Dec 2015 22:47:40 +0000
parents cf2fe741a582
children ce5c7214f9aa
comparison
equal deleted inserted replaced
535:d0576fb2a928 538:e9e2488bd0b7
15 15
16 # Return 0 if we should transpose down 2 octaves, 1 if just one 16 # Return 0 if we should transpose down 2 octaves, 1 if just one
17 # octave. $2 is highest note, $3 is lowest note. 17 # octave. $2 is highest note, $3 is lowest note.
18 # 18 #
19 # If range is G to d', transpose down 2 octaves. 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 20 # 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 21 # octave transposition, and the distance below C on a two octave
23 # transposition. Find the smallest, and use the corresponding 22 # transposition. Find the smallest, and use the corresponding
24 # transposition. 23 # transposition, preferring 2 octaves in case of a tie.
25 transposedowntwo() 24 transposedowntwo()
26 { 25 {
27 if (($3 >= 104 && $2 <= 115)); then 26 if (($3 >= 104 && $2 <= 115)); then
28 return 0; 27 return 0;
29 fi 28 fi
30 if (($3 < 100)); then 29 over=$(($2 - 108))
31 return 1; 30 if (($over < 0)); then
31 over=0
32 fi 32 fi
33 over=$(($2 - 108)) 33 under=$((100 - $3))
34 under=$((104 - $3)) 34 if (($under < 0)); then
35 if (($over <= $under)); then 35 under=0
36 fi
37 if (($over < $under)); then
36 return 1; 38 return 1;
37 fi 39 fi
38 40
39 return 0; 41 return 0;
40 } 42 }