10 tuba_note_42="moveleft back crouch fire"
11 tuba_note_43="back crouch fire"
12 tuba_note_44="moveright back crouch fire"
13 tuba_note_47="forward moveright crouch fire"
14 tuba_note_48="crouch fire"
15 tuba_note_49="moveleft back crouch fire2"
16 tuba_note_50="moveright crouch fire"
17 tuba_note_51="forward moveleft crouch fire"
18 tuba_note_52="forward crouch fire"
19 tuba_note_53="moveleft crouch fire"
20 tuba_note_54="moveleft back fire"
21 tuba_note_55="back fire"
22 tuba_note_56="back moveright fire"
23 tuba_note_57="moveright crouch fire2"
24 tuba_note_58="forward moveleft crouch fire2"
25 tuba_note_59="forward moveright fire"
27 tuba_note_61="moveleft back fire2"
28 tuba_note_62="moveright fire"
29 tuba_note_63="forward moveleft fire"
30 tuba_note_64="forward fire"
31 tuba_note_65="moveleft fire"
32 tuba_note_66="forward moveright fire2"
34 tuba_note_68="back moveright jump fire"
35 tuba_note_69="moveright fire2"
36 tuba_note_70="forward moveleft fire2"
37 tuba_note_71="forward fire2"
38 tuba_note_72="moveleft fire2"
39 tuba_note_73="moveleft back jump fire2"
40 tuba_note_74="moveright jump fire"
41 tuba_note_75="forward moveleft jump fire"
42 tuba_note_76="forward jump fire"
43 tuba_note_77="moveleft jump fire"
44 tuba_note_78="forward moveright jump fire2"
45 tuba_note_79="jump fire2"
46 tuba_note_81="moveright jump fire2"
47 tuba_note_82="forward moveleft jump fire2"
48 tuba_note_83="forward jump fire2"
49 tuba_note_84="moveleft jump fire2"
53 eval "tuba_note=\$tuba_note_$pitch"
54 if [ -z "$tuba_note" ]; then
55 echo >&2 "Cannot play note $pitch"
58 for n in $tuba_note; do
59 echo -n "${semi}${plusminus}${n}"
66 # Move the dot where it belongs.
76 [Cc]_|_[Cc]) pitch=-1 ;;
78 [Cc][#+]|[#+][Cc]|[Dd]_|_[Dd]) pitch=1 ;;
80 [Dd][#+]|[#+][Dd]|[Ee]_|_[Ee]) pitch=3 ;;
81 [Ee]|[Ff]_|_[Ff]) pitch=4 ;;
82 [Ff]|[Ee][#+]|[#+][Ee]) pitch=5 ;;
83 [Ff][#+]|[#+][Ff]|[Gg]_|_[Gg]) pitch=6 ;;
85 [Gg][#+]|[#+][Gg]|[Aa]_|_[Aa]) pitch=8 ;;
87 [Aa][#+]|[#+][Aa]|[Bb]_|_[Bb]) pitch=10 ;;
89 [Bb][#+]|[#+][Bb]) pitch=12 ;;
91 *) echo >&2 "Unrecognized note: $note" ;;
93 echo "// $length$note$octave"
94 # Calculate the duration.
101 length=$defaultlength
111 duration=$(echo "240 / $bpm / ${length%.} * $f" | bc -l)
112 if [ -n "$pitch" ]; then
113 # Calculate the MIDI pitch.
114 if [ -z "$octave" ]; then
115 octave=$defaultoctave
117 pitch=$((pitch + (octave - baseoctave) * 12 + transpose + 60))
120 noteoff=$(echo "$time + $duration + $gato" | bc -l)
123 noteoff=$(echo "$time + $gato" | bc -l)
126 echo "defer $time \"$(tuba +)\""
127 echo "defer $noteoff \"$(tuba -)\""
129 time=$(echo "$time + $duration" | bc -l)
139 while [ -n "$notes" ]; do
140 note=${notes%%[:, ]*}
157 defaultlength=${note#*=}
163 defaultoctave=${note#*=}
166 baseoctave=${note#*=}
169 octave=${note##*[cCdDeEfFgGaAbBp-]}
170 octave=${octave##[#+_]}
172 length=${note%[cCdDeEfFgGaAbBp-]*}
173 length=${length%%[#+_]}