I have 2 arrays:
beat = [1,0,0,0,0,0,0,3,2,0,0,0,3,0,0,0]
bassline1 = [0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0]
I scan through them like this and they run in sync, so far so good:
live_loop :mainbeat do
16.times do |i|
sync :tick
kick if beat[i] == 1
kickfill if beat [i]== 3
snare1 if beat[i] == 2
end
end
#read bass
live_loop :bassline1 do
16.times do |i|
sync :tick
sample basses, 5 if bassline1[i] ==1
end
end
end```
however there are 2 functions (kickfill and snare1) which include a sleep inside them, so when they are called they cause the arrays to be out of sync.
For example, this is how the function snare1 looks:
```#snare
define :snare1 do
with_fx :reverb do
if one_in 8
sample :sn_generic, sustain: 0.18, room: 1
sleep 0.175
sample :sn_generic, sustain: 0.18, room: 1, amp: 0.4
sleep 0.175
sample :sn_generic, sustain: 0.18, room: 1, amp: 0.2
else
sample :sn_generic, sustain: 0.18, room: 1
end
end
end```
I'm trying to have a randomised mini-snare-roll, but when that one_in 8 happens, the sync goes out.
Which brings me to my question:
can I delay an event without using 'sleep'?
I have a similar issue in kickfill, where a one_in triggers a randomly delayed kick...