# At Doom's Gate: the E1M1 riff for one speaker # https://lab.glossema.dev/play/dooms-gate # Doom, 1993. E minor, 170 bpm: the riff in eighths on a low E, the lead in quarters an octave up. :local beat 352ms; :global notes { "E3"=165; "Bb3"=233; "B3"=247; "C4"=262; "D4"=294; "E4"=330; "G4"=392; "B4"=494; "D5"=587; "E5"=659; "F#5"=740; "G5"=784; "A5"=880; "B5"=988 }; :global durs { "w"=($beat * 4); "h"=($beat * 2); "q"=$beat; "e"=($beat / 2) }; # $play "NOTE:dur" sounds one note; "-" is a rest. # The gap is carved out of the note, not added after it, so the grid holds at 170. :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 - 24ms); } :delay $len; } # The riff: two low E's, then the note that walks down, the octave, D, C, B flat, and back up :local riff { "E3:e"; "E3:e"; "E4:e"; "E3:e"; "E3:e"; "D4:e"; "E3:e"; "E3:e"; "C4:e"; "E3:e"; "E3:e"; "Bb3:e"; "E3:e"; "E3:e"; "B3:e"; "C4:e" }; # The riff's second half: the walk stops on B flat and holds it :local held { "E3:e"; "E3:e"; "E4:e"; "E3:e"; "E3:e"; "D4:e"; "E3:e"; "E3:e"; "C4:e"; "E3:e"; "E3:e"; "Bb3:h"; "-:e" }; # The riff's first bar, then the lead's answer set into the gap where the B flat would hold :local lead1 { "E3:e"; "E3:e"; "E4:e"; "E3:e"; "E3:e"; "D4:e"; "E3:e"; "E3:e"; "B4:q"; "D5:q"; "F#5:q"; "A5:q"; "F#5:q"; "D5:q"; "B4:h" }; :local lead2 { "E3:e"; "E3:e"; "E4:e"; "E3:e"; "E3:e"; "D4:e"; "E3:e"; "E3:e"; "B4:q"; "G4:q"; "E5:q"; "G5:q"; "B5:q"; "G5:q"; "E5:h" }; # 1. Riff: twice in full, hard and even :put "Riff"; :for i from=1 to=2 do={ :foreach n in=$riff do={ $play $n; } :foreach n in=$held do={ $play $n; } } # 2. Lead: the riff, then the lead answers in its gap; twice, the answer climbing :put "Lead"; :foreach n in=$riff do={ $play $n; } :foreach n in=$lead1 do={ $play $n; } :foreach n in=$riff do={ $play $n; } :foreach n in=$lead2 do={ $play $n; } # 3. Riff again: once more in full, and the gate shuts on the riff's own first cell :put "Riff again"; :foreach n in=$riff do={ $play $n; } :foreach n in=$held do={ $play $n; } :local shut {"E3:e"; "E3:e"; "E4:w"}; :foreach n in=$shut do={ $play $n; }