# Prince of Persia (1989): the title theme, for one speaker # https://lab.glossema.dev/play/prince-of-persia # G minor with the raised seventh, the augmented second Eb to F#; every ornament a # semitone above its note. Sixteenth = 180ms, quarter = 720ms: the slow strain at # about 83 bpm, the Dance at twice that, its eighth the Title's sixteenth. :local s 180ms; :global notes { "C4"=262; "D4"=294; "G4"=392; "Ab4"=415; "A4"=440; "Bb4"=466; "B4"=494; "C5"=523; "C#5"=554; "D5"=587; "Eb5"=622; "E5"=659; "F5"=698; "F#5"=740; "G5"=784; "Ab5"=831; "A5"=880; "B5"=988 }; # g = grace, t = the quick repeated note, s e d q = sixteenth eighth dotted-eighth quarter, # l = quarter and a sixteenth, dq = dotted quarter :global durs { "g"=($s / 3); "t"=($s / 2); "s"=$s; "e"=($s * 2); "d"=($s * 3); "q"=($s * 4); "l"=($s * 5); "dq"=($s * 6) }; # $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. Title: the slow strain, long-short-short-short-long-long, each turn a grace above its note; # then the answer, the turns written out, down to the long G :put "Title"; :local title { "-:s"; "C4:d"; "G4:s"; "G4:s"; "G4:s"; "Ab4:g"; "G4:d"; "G4:d"; "C#5:g"; "C5:d"; "G4:s"; "G4:s"; "G4:s"; "C5:d"; "C#5:s"; "E5:s"; "C#5:s"; "C5:d"; "G4:s"; "G4:s"; "G4:s"; "Ab4:g"; "G4:d"; "G4:d"; "F#5:g"; "F5:d"; "C5:s"; "C5:s"; "C5:s"; "F5:d"; "F#5:s"; "A5:s"; "F#5:s"; "F5:d"; "C5:s"; "C5:s"; "C5:s"; "C#5:g"; "C5:q"; "C5:dq"; "C5:s" }; :foreach n in=$title do={ $play $n; } :local answer { "A4:q"; "A4:dq"; "A4:t"; "A4:t"; "A4:t"; "A5:q"; "D5:l"; "Eb5:s"; "F#5:s"; "Eb5:s"; "D5:d"; "Eb5:t"; "F#5:t"; "Eb5:t"; "D5:q"; "G5:l"; "Ab5:s"; "B5:s"; "Ab5:s"; "G5:q"; "G4:l"; "Ab4:s"; "B4:s"; "Ab4:s"; "G4:dq"; "G4:e"; "-:e" }; :foreach n in=$answer do={ $play $n; } # 2. Dance: the same strains in even notes at twice the speed, then the finale's run up to G :put "Dance"; :local dance { "G4:s"; "G4:s"; "G4:s"; "C5:s"; "C#5:s"; "E5:s"; "C#5:s"; "C5:s"; "C5:s"; "C5:s"; "C5:s"; "F5:s"; "F#5:s"; "A5:s"; "F#5:s"; "F5:s"; "A4:s"; "A4:s"; "A4:s"; "A5:s"; "D5:s"; "Eb5:s"; "F#5:s"; "Eb5:s"; "D5:s"; "Eb5:s"; "F#5:s"; "Eb5:s"; "D5:s"; "C5:s"; "Bb4:s"; "A4:s"; "D4:s"; "G4:s"; "C5:s"; "Bb4:s"; "G4:s"; "D4:s"; "G4:s"; "Bb4:s"; "Eb5:s"; "D5:s"; "Bb4:s"; "G4:s"; "A4:s"; "D5:s"; "F#5:s"; "G5:e"; "-:e" }; :foreach n in=$dance do={ $play $n; } # 3. Title again: the slow strain once more, and the cadence: the turn on G high, then low :put "Title again"; :foreach n in=$title do={ $play $n; } :local cadence { "G5:l"; "Ab5:s"; "B5:s"; "Ab5:s"; "G5:q"; "G4:l"; "Ab4:s"; "B4:s"; "Ab4:s"; "G4:dq"; "G4:e" }; :foreach n in=$cadence do={ $play $n; }