12 tuba_note_42="moveleft back crouch fire"
13 tuba_note_43="back crouch fire"
14 tuba_note_44="moveright back crouch fire"
15 tuba_note_47="forward moveright crouch fire"
16 tuba_note_48="crouch fire"
17 tuba_note_49="moveleft back crouch fire2"
18 tuba_note_50="moveright crouch fire"
19 tuba_note_51="forward moveleft crouch fire"
20 tuba_note_52="forward crouch fire"
21 tuba_note_53="moveleft crouch fire"
22 tuba_note_54="moveleft back fire"
23 tuba_note_55="back fire"
24 tuba_note_56="back moveright fire"
25 tuba_note_57="moveright crouch fire2"
26 tuba_note_58="forward moveleft crouch fire2"
27 tuba_note_59="forward moveright fire"
29 tuba_note_61="moveleft back fire2"
30 tuba_note_62="moveright fire"
31 tuba_note_63="forward moveleft fire"
32 tuba_note_64="forward fire"
33 tuba_note_65="moveleft fire"
34 tuba_note_66="forward moveright fire2"
36 tuba_note_68="back moveright jump fire"
37 tuba_note_69="moveright fire2"
38 tuba_note_70="forward moveleft fire2"
39 tuba_note_71="forward fire2"
40 tuba_note_72="moveleft fire2"
41 tuba_note_73="moveleft back jump fire2"
42 tuba_note_74="moveright jump fire"
43 tuba_note_75="forward moveleft jump fire"
44 tuba_note_76="forward jump fire"
45 tuba_note_77="moveleft jump fire"
46 tuba_note_78="forward moveright jump fire2"
47 tuba_note_79="jump fire2"
48 tuba_note_81="moveright jump fire2"
49 tuba_note_82="forward moveleft jump fire2"
50 tuba_note_83="forward jump fire2"
51 tuba_note_84="moveleft jump fire2"
55 eval "tuba_note=\$tuba_note_$pitch"
56 if [ -z "$tuba_note" ]; then
57 echo >&2 "Cannot play note $pitch"
60 for n in $tuba_note; do
61 echo -n "${semi}${plusminus}${n}"
68 # Move the dot where it belongs.
78 [Cc]_|_[Cc]) pitch=-1 ;;
80 [Cc][#+]|[#+][Cc]|[Dd]_|_[Dd]) pitch=1 ;;
82 [Dd][#+]|[#+][Dd]|[Ee]_|_[Ee]) pitch=3 ;;
83 [Ee]|[Ff]_|_[Ff]) pitch=4 ;;
84 [Ff]|[Ee][#+]|[#+][Ee]) pitch=5 ;;
85 [Ff][#+]|[#+][Ff]|[Gg]_|_[Gg]) pitch=6 ;;
87 [Gg][#+]|[#+][Gg]|[Aa]_|_[Aa]) pitch=8 ;;
89 [Aa][#+]|[#+][Aa]|[Bb]_|_[Bb]) pitch=10 ;;
91 [Bb][#+]|[#+][Bb]) pitch=12 ;;
93 *) echo >&2 "Unrecognized note: $note" ;;
95 echo "// $length$note$octave"
96 # Calculate the duration.
103 length=$defaultlength
113 duration=$(echo "240 / $bpm / ${length%.} * $f" | bc -l)
114 if [ -n "$pitch" ]; then
115 # Calculate the MIDI pitch.
116 if [ -z "$octave" ]; then
117 octave=$defaultoctave
119 pitch=$((pitch + (octave - baseoctave) * 12 + transpose + 60))
122 noteoff=$(echo "$time + $duration + $gato" | bc -l)
125 noteoff=$(echo "$time + $gato" | bc -l)
129 minnoteoff = $time + $mingato;
130 maxnoteoff = $time + $duration + $maxgato;
132 if (noteoff > maxnoteoff) { noteoff = maxnoteoff; }
133 if (noteoff < minnoteoff) { noteoff = minnoteoff; }
136 echo "defer $time \"$(tuba +)\""
137 echo "defer $noteoff \"$(tuba -)\""
139 time=$(echo "$time + $duration" | bc -l)
149 while [ -n "$notes" ]; do
150 note=${notes%%[:, ]*}
167 defaultlength=${note#*=}
173 defaultoctave=${note#*=}
176 baseoctave=${note#*=}
179 octave=${note##*[cCdDeEfFgGaAbBp-]}
180 octave=${octave##[#+_]}
182 length=${note%[cCdDeEfFgGaAbBp-]*}
183 length=${length%%[#+_]}