Skip to content

Instantly share code, notes, and snippets.

@OnixIsThePewterGod
Created October 27, 2019 17:53
Show Gist options
  • Save OnixIsThePewterGod/2aea6e7e4fd315125ee345a3a00f6087 to your computer and use it in GitHub Desktop.
Save OnixIsThePewterGod/2aea6e7e4fd315125ee345a3a00f6087 to your computer and use it in GitHub Desktop.
Industrial Beat - my Sonic Pi masterpiece. | 100 lines, 2 minutes 0 seconds.
# Define the delay (we wiil change it soon!)
delay = 0.90
# Start the opening sequence (with snare drums)
3.times do
sample :sn_dub
sleep 0.45
end
sample :sn_zome
sleep 0.45
# Define the first a-section, with an industrial loop
# (here it uses the delay variable!)
define :a1 do
8.times do
sample :loop_industrial
sleep delay
end
end
# Define the second a-section, which is the same as a1
# but with a rate change (and loop 15 times!)
define :a2 do
15.times do
sample :loop_industrial, rate: 0.5
sleep delay
end
end
# Define the first b-section, which plays notes
# with the echo fx
define :b1 do
4.times do
with_fx :echo do
play 70
sleep delay
end
end
end
# Define the second b-section, which is the same as
# b1 but the certain note played has changed
define :b2 do
4.times do
with_fx :echo do
play 66
sleep delay
end
end
end
# Introduce the first loop
a1
# Define a needed loop
define :both_bs do
2.times do
b1
b2
end
end
# Define the first section!
define :section_a do
# Thread two a1 loops with the next loop
in_thread do
a1
a1
end
# Play b1 THEN b2 at the same time as the a1 loop, but
# twice, all using the both_bs loop above
both_bs # End of first thread
# Thread a lunar_land sample with the both_bs loop
in_thread do
sample :ambi_lunar_land
end
# Change the delay!
delay = 1
both_bs
# Normalize the delay
delay = 0.90 # End of second thread
end
# Last section is defined. Same as section_a but it uses
# the a2 loop instead of a1, and is longer.
define :section_b do
in_thread do
a2
end
both_bs
2.times do
in_thread do
sample :ambi_lunar_land
end
delay = 1
both_bs
delay = 0.90
end
sample :loop_industrial, rate: 0.2, sustain: 2.1
sleep 2.2
sample :loop_industrial, rate: 0.2, sustain: 2.9
end
# Here is the main section!
# Run section_a twice, then run section_b
2.times do
section_a
end
section_b
# Alright, it's over!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment