# Teenage Mutant Ninja Turtles (1987 theme / NES title screen) # for one RouterOS beeper --- https://lab.glossema.dev/play/turtles # --- Tuning: equal temperament, integer Hz ----------------------------------- :global notes { "D3"=147; "F3"=175; "G3"=196; "Ab3"=208; "A3"=220; "C4"=262; "D4"=294; "F4"=349; "A4"=440; "C5"=523; "D5"=587; "F5"=698; "A5"=880 }; # --- Clock: 150 bpm, so the beat is 400ms and the riff runs in 200ms eighths -- :local beat 400ms; :global durs { "s"=($beat / 4); "e"=($beat / 2); "q"=$beat; "h"=($beat * 2); "w"=($beat * 4) }; :global gap 20ms; # --- One voice: sound a note, then hold the clock so the notes articulate ----- :global play do={ :global notes; :global durs; :global gap; :local d ($durs->$2); :if ($1 = "-") do={ :delay ($d + $gap); } else={ :local f ($notes->$1); :beep frequency=$f length=$d; :delay ($d + $gap); } } # --- Walk a melody written as "NOTE:dur" strings ------------------------------ :global phrase do={ :global play; :foreach n in=$1 do={ :local c [:find $n ":"]; :local note [:pick $n 0 $c]; :local dur [:pick $n ($c + 1) [:len $n]]; $play $note $dur; } } # --- Part 1: the riff, even eighths, third and fourth octaves ----------------- :local riff { "D3:e"; "D3:e"; "F3:e"; "G3:e"; "D3:e"; "D3:e"; "G3:e"; "F3:e"; "D3:e"; "D3:e"; "F3:e"; "G3:e"; "Ab3:e"; "A3:e"; "C4:e"; "D4:e" }; # --- Part 2: the chant, set into the riff's gaps ------------------------------ # A low bass note lands on the strong beat wherever the voice rests. :local chant { "D3:e"; "A4:e"; "A4:e"; "A4:e"; "A4:e"; "A4:e"; "A4:e"; "C5:e"; "D5:q"; "-:q"; "D3:e"; "F3:e"; "G3:e"; "A3:e"; "D3:e"; "A4:e"; "A4:e"; "A4:e"; "A4:e"; "A4:e"; "A4:e"; "C5:e"; "D5:q"; "-:q"; "D3:e"; "F3:e"; "G3:e"; "Ab3:e"; "D3:e"; "D5:e"; "D5:e"; "C5:e"; "C5:e"; "A4:e"; "A4:q"; "D3:e"; "F3:e"; "G3:e"; "A3:e"; "D3:e"; "D3:e"; "F3:e"; "G3:e" }; # --- Part 3: "turtle power" --- the answering cadence and the shout ----------- :local power { "D3:e"; "A4:e"; "A4:e"; "C5:e"; "D5:h"; "D3:e"; "F3:e"; "G3:e"; "Ab3:e"; "A3:e"; "C5:e"; "D5:e"; "F5:e"; "A5:w"; "-:q"; "D3:q"; "D5:w" }; # --- Performance -------------------------------------------------------------- :put "Riff"; :for i from=1 to=2 do={ $phrase $riff; } :put "Chant"; $phrase $chant; $phrase $riff; $phrase $chant; :put "Turtle power"; $phrase $power;