# Green Hill Zone: a score for one speaker # https://lab.glossema.dev/play/green-hill # Sonic the Hedgehog, 1991 (Masato Nakamura). C major, 130 bpm, swung eighths. :local beat 462ms; :global notes { "C3"=131; "D3"=147; "E3"=165; "F3"=175; "C4"=262; "D4"=294; "E4"=330; "F4"=349; "G4"=392; "A4"=440; "B4"=494; "C5"=523; "D5"=587; "E5"=659 }; # The swing: a long eighth L leads the beat, a short one s follows it; L + s = q :global durs { "s"=($beat / 3); "L"=(($beat * 2) / 3); "q"=$beat; "h"=($beat * 2); "hs"=(($beat * 2) + ($beat / 3)); "w"=($beat * 4) }; # $play "NOTE:dur" sounds one note; "-" is a rest :global play do={ :global notes; :global durs; :local cut [:find $1 ":"]; :local note [:pick $1 0 $cut]; :local key [:pick $1 ($cut + 1) [:len $1]]; :local len ($durs->$key); :if ($note != "-") do={ :beep frequency=($notes->$note) length=$len; } :delay ($len + 20ms); } # 1. Call: the bass steps on F, the tune rises and turns and lands on G; a pickup, and it lands on G again :put "Call"; :local call { "F3:L"; "-:s"; "C5:L"; "A4:q"; "C5:s"; "B4:q"; "C5:L"; "B4:q"; "G4:h"; "-:s"; "F3:L"; "G4:s"; "E5:L"; "D5:q"; "C5:s"; "B4:q"; "C5:L"; "B4:q"; "G4:h"; "-:s" }; :foreach n in=$call do={ $play $n; } # 2. Answer: the same rise, then the bass walks down to D and the tune falls home to C :put "Answer"; :local answer { "F3:L"; "-:s"; "C5:L"; "A4:q"; "C5:s"; "B4:q"; "C5:L"; "B4:q"; "G4:h"; "-:s"; "D3:L"; "A4:s"; "A4:L"; "F4:q"; "A4:s"; "G4:q"; "A4:L"; "G4:q"; "C4:h"; "-:s" }; :foreach n in=$answer do={ $play $n; } # 3. Call again: the call once more, closed with the answer's own cadence :put "Call again"; :local again { "F3:L"; "-:s"; "C5:L"; "A4:q"; "C5:s"; "B4:q"; "C5:L"; "B4:q"; "G4:h"; "-:s"; "F3:L"; "G4:s"; "E5:L"; "D5:q"; "C5:s"; "B4:q"; "C5:L"; "B4:q"; "G4:hs"; "A4:L"; "G4:q"; "C4:w" }; :foreach n in=$again do={ $play $n; }