From 297ca4ff2a5e8344478db1c9182e5c710bbe189f Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Fri, 24 Jun 2022 15:12:38 +0200 Subject: InComm --- sounds/helrunar-vanitas-vanitatum.rsc | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sounds/helrunar-vanitas-vanitatum.rsc diff --git a/sounds/helrunar-vanitas-vanitatum.rsc b/sounds/helrunar-vanitas-vanitatum.rsc new file mode 100644 index 0000000..525ffd6 --- /dev/null +++ b/sounds/helrunar-vanitas-vanitatum.rsc @@ -0,0 +1,63 @@ +# +# MIDI player by MikroTourette 2017 +# with enhancements by jgro 2022 +# notes/music part by lirion 2022 +# ---WiP--- +# +# notes is array of MIDI notes with optional length: note/length +# Length is number of ticks. If omitted, length will be set to $defaultTicks. +# Use 0 for rests. + +:local notes 62/8,62/4,64/4,65/4,67/4,69/16,62/8,74/8,74/4,72/4,70/4,72/4,69/16,62/8,58/8,58/4,62/4,70/8,57/8,57/4,61/4,69/8,64/8,69/8,64/8,62/16,0/8,62/8,62/4,64/4,65/4,67/4,69/16,0/8,74/8,74/4,72/4,70/4,72/4,69/16,0/4,58/8,58/4,62/4,70/8,57/8,57/4,61/4,69/8,64/8,65/8,64/8,62/16,0/4,62/8,62/4,64/4,65/4,67/4,69/16,62/8,74/8,74/4,72/4,70/4,72/4,69/16,62/8,58/8,58/4,62/4,70/8,57/8,57/4,61/4,69/8,64/8,69/8,64/8,62/16,0/8,62/8,62/4,64/4,65/4,67/4,69/16,0/8,74/8,74/4,72/4,70/4,72/4,69/16,0/4,58/8,58/4,62/4,70/8,57/8,57/4,61/4,69/8,64/8,65/8,64/8,62/16,0/2,57/2,61/2,64/2,65/2,61/2,57/4,61/4,57/4,61/4,57/4,62/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,62/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,62/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,62/4,57/4,61/4,57/4,61/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,62/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,62/4,57/4,65/4,57/4,65/4,57/4,64/4,57/4,64/4,57/4,64/4,57/4,62/4,57/4,64/4,57/4,64/4,57/4,64/4,57/4,64/4,57/4,64/4,57/4,62/4,57/4,64/4,57/4,64/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,62/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,69/4,57/4,69/4,57/4,69/4,57/4,64/4,57/4,64/4,57/4,64/4,57/4,62/4,57/4,64/4,57/4,64/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,62/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,69/4,57/4,69/4,57/4,69/4,57/4,64/4,57/4,64/4,57/4,64/4,57/4,62/4,57/4,64/4,57/4,64/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,58/4,57/4,58/4,57/4,58/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,62/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,65/4,57/4,69/4,57/4,69/4,57/4,69/4,57/4,64/4,57/4,64/4,57/4,64/4,57/4,62/4,57/4,64/4,57/4,64/4,57/4,61/4,57/4,61/4,57/4,61/4,57/4,58/4,57/4,58/4,57/4,58/4,57/4,65/72,69/24,64/48,61/24,58/24,65/72,69/24,64/48,61/24,58/24; + +# Tempo +# Because clock resolution is only 10ms, you need much longer ticks than standard MIDI +:local tick 50ms; # length of a tick +:local defaultTicks 4; # default number of ticks for a note +:local stacc 10ms; # length of break between notes +:local transpose 0; # number to add to or subtract from each note (12 is 1 octave) + +# MIDI player +# Frequencies from C9 (MIDI 120) through B9 (beyond MIDI top note of 127) +:local frqtab 8372,8869,9397,9956,10548,11175,11839,12543,13288,14080,14916,15804; +:local n0; :local n; +:local d0; :local d; +:local l; +:local midi; +:local i; +:local octa; +:local frq; +:local tones; +:local durations; +:for i from=0 to= ([:len $notes]-1) do={ + :local entry [:pick $notes $i]; + :local div [:find $entry "/"]; + :if ([:typeof $div] = "nil") do={ + :set tones ($tones, $entry); + :set durations ($durations, $defaultTicks); + } else={ + :set tones ($tones, [:pick $entry 0 $div]); + :set durations ($durations, [:pick $entry ($div + 1) [:len $entry]]); + } +} + +:for i from=0 to= ([:len $notes]-1) do={ + :set midi [:pick $tones $i]; + :set midi ($midi + $transpose); + :set octa 0; + :while ($midi < 120) do={:set midi ($midi + 12); :set octa ($octa + 1); }; + :set midi ($midi % 12); + :set frq [:tonum [:pick $frqtab $midi]]; + :set frq ($frq>>($octa)); + :set d0 [:pick $durations $i]; + + :set d ($d0 * $tick ); + :set l ($d0 * ($tick - $stacc)); + # :put $midi; + # :put $frq; + # :put $octa; + if ($frq >= 20) do={ + :beep frequency=$frq length=$l; + } + :delay $d; +} -- cgit v1.2.3