This uses some slightly more interesting drum pattern randomization than I had previously been using. It kind of uses a 2-dimensional approach:
snares = [
ringify('0000 1000 0000 1000'),
ringify('0000 1000 0000 1010'),
ringify('0100 1000 0000 1000')
]
snare_dur = [
[4, 1],
[4, 1],
[4, 1],
[4, 1],
[8, 2],
[12, 3],
[12, 3],
[12, 3],
[24, 6],
[64, 4],
[64, 4],
[64, 4],
[128, 8],
[128, 8],
[128, 8],
].ring
The combined result is as follows:
live_loop :bt do
r = rhythm.tick
p = pattern.tick # select which pattern
# Kicks
# ... kicks code
# Snares
in_thread do
s = snares[p][r]
if s == 1
d = snare_dur.choose # duration randomly checked.
d[1].times do |n|
l = (4.0 - n).abs * LEVELS[:snares]
dur = M/d[0]
sample :sn_dolf, amp: l
sleep dur
end
end
end
# Claps
## ... claps code
end
To see this in action, checkout an example of a track I made using this system on YouTube