Skip to content

Instantly share code, notes, and snippets.

@binarysweets
Created July 6, 2021 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binarysweets/d8b12a90774799a71cf8f597434f0f68 to your computer and use it in GitHub Desktop.
Save binarysweets/d8b12a90774799a71cf8f597434f0f68 to your computer and use it in GitHub Desktop.
# Sonic Pi v3.2.2 (Win 10)
# Settings
use_bpm 87
bar_length = 4
use_random_seed 1950
root = "~Samples/"
sample_folder = root + "Vox/"
drums_folder = root + "Drums/"
sam = [1,2,3,4]
# Functions
define :bar do |length = 8|
sleep bar_length * length
end
# Loops
define :sam1 do |length = 8, pattern = 1|
in_thread do
((bar_length * length) * 2).times do ; tick
sample sample_folder, sam[0],
slice: look,
amp: rrand(2, 2.2),
rate: 0.1,
release: 0.1
sleep (ring 0.4, 0.6, 0.6, 0.4).look
end
end
end
define :sam2 do |length = 8, pattern = 1|
in_thread do
((bar_length * length / 4)).times do ; tick
sample sample_folder, sam[1],
amp: rrand(0.7, 0.9),
rate: (line 1.2, 0.6, steps: 8).mirror.look
sleep 4
end
end
end
define :sam3 do |length = 8, pattern = 1|
in_thread do
with_fx :flanger, feedback: 0.9, depth: 10, delay: 20, wave: 1 do
((bar_length * length / 8)).times do ; tick
sleep 4
sample sample_folder, sam[2],
amp: rrand(0.8, 1.0),
rate: (line -1, -0.6, steps: 8).look
sleep 4
end
end
end
end
define :sam4 do |length = 8, pattern = 1|
in_thread do
with_fx :echo, decay: 8, phase: 0.5 do
((bar_length * length)).times do ; tick
sample sample_folder, sam[3],
amp: 1,
slice: look,
pan: (line -1, 1, steps: 16).look
sleep 1
end
end
end
end
define :drms do |length = 8, pattern = 1|
in_thread do
with_fx :flanger, feedback: 0.95, depth: 20, delay: 20, wave: 2 do
((bar_length * length) * 2).times do ; tick
sample drums_folder, (line 30, 40, steps: 10).choose.to_i,
rate: 0.1,
finish: 0.1,
amp: rrand(0.7, 0.9) if bools(0,1,1,0, 1,0,0,1, 1,0,0,1, 0,1,0,1).look
sleep 0.5
end
end
end
end
# Structure
with_fx :reverb, room: 0.5, damp: 0.4 do
with_fx :eq, low_note: 16, low: -0.5 do
drms ; bar
sam = [10,2,3,4]
sam1 ; sam3 ; sam4 ; drms ; bar
sam = [1,8,9,10]
sam1 ; sam2 ; sam3 ; sam4 ; bar
sam = [1,2,3,7]
sam1 ; sam2 ; sam3 ; sam4 ; bar
sam = [110,75,18,17]
sam1 ; sam3 ; sam4 ; bar
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment