Skip to content

Instantly share code, notes, and snippets.

@danwrong
Created September 30, 2014 07:29
Show Gist options
  • Save danwrong/9ab752ebaa822a33c976 to your computer and use it in GitHub Desktop.
Save danwrong/9ab752ebaa822a33c976 to your computer and use it in GitHub Desktop.
num_chops = 16
slice_length = sample_duration(:loop_amen_full) / num_chops
effects = [:distortion, :distortion, :slicer, :wobble]
define :play_slice do |slice|
if slice == 0
start = 0
else
start = (1.0 / num_chops) * slice
end
finish = start + (1.0 / num_chops)
sample :loop_amen_full, start: start, finish: finish
end
define :first_bit do
synth_hit :e2
play_slice 0
sleep slice_length
play_slice 1
sleep slice_length
play_slice 2
sleep slice_length
play_slice 9
sleep slice_length
end
define :synth_hit do |note|
use_synth :tb303
with_fx :distortion do
play note, release: slice_length, cutoff: rrand(60, 120)
end
end
loop do
sample :ambi_drone
with_fx :distortion do
first_bit
end
4.times do
slice = rrand(0, num_chops - 1).to_i
effect = effects[rrand(0, effects.size).to_i]
with_fx effect do
play_slice slice
end
synth_hit choose(scale(:e1, :minor)) if [1,3,5].include?(slice)
sleep slice_length
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment