Heroes in a half shell: the riff, the chant, turtle power.
1# Teenage Mutant Ninja Turtles (1987 theme / NES title screen)2# for one RouterOS beeper --- https://lab.glossema.dev/play/turtles34# --- Tuning: equal temperament, integer Hz -----------------------------------5:globalnotes{6"D3"=147;"F3"=175;"G3"=196;"Ab3"=208;"A3"=220;7"C4"=262;"D4"=294;"F4"=349;"A4"=440;8"C5"=523;"D5"=587;"F5"=698;"A5"=8809};1011# --- Clock: 150 bpm, so the beat is 400ms and the riff runs in 200ms eighths --12:localbeat 400ms;13:globaldurs{14"s"=($beat/ 4);"e"=($beat/ 2);"q"=$beat;15"h"=($beat* 2);"w"=($beat* 4)16};17:globalgap 20ms;1819# --- One voice: sound a note, then hold the clock so the notes articulate -----20:globalplaydo={21:globalnotes;22:globaldurs;23:globalgap;24:locald($durs->$2);25:if($1="-")do={26:delay($d+$gap);27 }else={28:localf($notes->$1);29:beepfrequency=$flength=$d;30:delay($d+$gap);31 }32}3334# --- Walk a melody written as "NOTE:dur" strings ------------------------------35:globalphrasedo={36:globalplay;37:foreachnin=$1do={38:localc[:find$n":"];39:localnote[:pick$n 0 $c];40:localdur[:pick$n($c+ 1)[:len$n]];41 $play$note$dur;42 }43}4445# --- Part 1: the riff, even eighths, third and fourth octaves -----------------46:localriff{47"D3:e";"D3:e";"F3:e";"G3:e";"D3:e";"D3:e";"G3:e";"F3:e";48"D3:e";"D3:e";"F3:e";"G3:e";"Ab3:e";"A3:e";"C4:e";"D4:e"49};5051# --- Part 2: the chant, set into the riff's gaps ------------------------------52# A low bass note lands on the strong beat wherever the voice rests.53:localchant{54"D3:e";"A4:e";"A4:e";"A4:e";"A4:e";"A4:e";"A4:e";"C5:e";55"D5:q";"-:q";"D3:e";"F3:e";"G3:e";"A3:e";56"D3:e";"A4:e";"A4:e";"A4:e";"A4:e";"A4:e";"A4:e";"C5:e";57"D5:q";"-:q";"D3:e";"F3:e";"G3:e";"Ab3:e";58"D3:e";"D5:e";"D5:e";"C5:e";"C5:e";"A4:e";"A4:q";59"D3:e";"F3:e";"G3:e";"A3:e";"D3:e";"D3:e";"F3:e";"G3:e"60};6162# --- Part 3: "turtle power" --- the answering cadence and the shout -----------63:localpower{64"D3:e";"A4:e";"A4:e";"C5:e";"D5:h";65"D3:e";"F3:e";"G3:e";"Ab3:e";66"A3:e";"C5:e";"D5:e";"F5:e";67"A5:w";68"-:q";"D3:q";"D5:w"69};7071# --- Performance --------------------------------------------------------------72:put"Riff";73:forifrom=1 to=2 do={$phrase$riff;}7475:put"Chant";76$phrase$chant;77$phrase$riff;78$phrase$chant;7980:put"Turtle power";81$phrase$power;
/
NoteFreqLine
On the router: paste the script into a terminal, or upload the file and run it.