You mean so that the same fx always goes with the same drum? One way would be to pair the drums with an effect and choose them together, something like this:
Drums1 = "User/Me/Desktop/SetSonicPi/Drums1.wav"
Drums2 = "User/Me/Desktop/SetSonicPi/Drums2.wav"
Drums3 = "User/Me/Desktop/SetSonicPi/Drums3.wav"
Drums4 = "User/Me/Desktop/SetSonicPi/Drums4.wav"
live_loop :Drums do
drum, fx = [[Drums1, :krush],
[Drums2, :slicer],
[Drums3, :echo],
[Drums4, :flanger]].choose
with_fx fx do
sample drum
end
sleep sample_duration Drums1
end
Although if you then want to add different parameters to the fx it gets a bit more complicated:
Drums1 = "User/Me/Desktop/SetSonicPi/Drums1.wav"
Drums2 = "User/Me/Desktop/SetSonicPi/Drums2.wav"
Drums3 = "User/Me/Desktop/SetSonicPi/Drums3.wav"
Drums4 = "User/Me/Desktop/SetSonicPi/Drums4.wav"
live_loop :Drums do
drum, fx, par = [[Drums1, :krush, {amp: 2}],
[Drums2, :slicer, {phase: 0.5, decay: 1.5}],
[Drums3, :echo, {phase: 0.25}],
[Drums4, :flanger, {phase: 1}]].choose
with_fx fx, **par do
sample drum
end
sleep sample_duration Drums1
end
At that point it might be simpler and more flexible to just have a case statement with the different options:
Drums1 = "User/Me/Desktop/SetSonicPi/Drums1.wav"
Drums2 = "User/Me/Desktop/SetSonicPi/Drums2.wav"
Drums3 = "User/Me/Desktop/SetSonicPi/Drums3.wav"
Drums4 = "User/Me/Desktop/SetSonicPi/Drums4.wav"
live_loop :Drums do
case rand_i(4)
when 0
with_fx :krush, amp: 2 do
sample Drums1
end
when 1
with_fx :slicer, phase: 0.5, decay: 1.5 do
sample Drums2
end
when 2
with_fx :echo, phase: 0.25 do
sample Drums3
end
when 3
with_fx :flanger, phase: 1 do
sample Drums4
end
end
sleep sample_duration Drums1
end
Hopefully one of these works for you. Note that some of the things here (e.g. case) are from Ruby and not strictly supported by Sonic Pi, so they might not continue working in later versions.