Skip to content

Instantly share code, notes, and snippets.

@hexnickk
Last active September 24, 2023 18:27
Show Gist options
  • Select an option

  • Save hexnickk/deb2e28fbc0f78ddc51088b7887e94bb to your computer and use it in GitHub Desktop.

Select an option

Save hexnickk/deb2e28fbc0f78ddc51088b7887e94bb to your computer and use it in GitHub Desktop.
# Based on https://github.com/euruband/sonic-pi-examples/blob/master/seven_nation_army.rb
tick = 1.0
half = 0.5*tick
quart = 0.25*tick
eigth = 0.125*tick
length = 8*tick
define :dotted do |note|
1.5*note
end
define :bass_guitar do
play :e3
sleep dotted(half)
play :e3
sleep quart
play :g3, release: 0.4
sleep dotted(quart)
play :e3, release: 0.4
sleep dotted(quart)
play :d3, release: 0.4
sleep quart
play :c3, release: 0.8
sleep tick
play :b2
sleep tick
end
define :permanent_drumset do
length.to_i.times.each_with_index do |_, i|
sample :drum_bass_soft
sample :drum_cymbal_closed if i % 8 == 3
sleep half
end
end
in_thread(name: :the_red_line) do
sync :frame
with_fx :compressor, amp: 0.8 do
loop do
with_synth :prophet do
bass_guitar
end
end
end
end
in_thread(name: :frame) do
loop do
cue :frame
permanent_drumset
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment