Skip to content

Instantly share code, notes, and snippets.

@xavriley
Last active April 21, 2020 02:36
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xavriley/418f8283af2fbe95fc90 to your computer and use it in GitHub Desktop.
Save xavriley/418f8283af2fbe95fc90 to your computer and use it in GitHub Desktop.
Recreating the THX sound with SonicPi
# THX Deep Note
# Second draft
# see http://www.earslap.com/article/recreating-the-thx-deep-note.html
time = 10
wait_time = (time / 3)
synths = []
rand_note = -> { rrand(note(:A2), note(:A4)) }
with_fx :normaliser, amp: 0.5 do
use_synth :dsaw
30.times do
# collect the synths in an array for controlling later
synths << lambda { play(rand_note.call, detune: rrand(0,1),
detune_slide: time,
sustain: time,
pan: rrand(0, 1)) }.call
end
sleep wait_time
synths.each do |t|
if (rrand(0.0, 1.0) > 0.5)
# some go up
t.control note: 70, note_slide: rrand(wait_time, (time - 2)), detune: 0.1
else
# others go down
t.control note: 46, note_slide: rrand(wait_time, (time - 2)), detune: 0.1
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment