One option would be to make an array of 16 numbers that add up to 8, and shuffle them so that they play in a random order, but the total time will always be the same. Something like this maybe:
live_loop :test do
times = [1, 0.25, 0.25, 0.25, 0.75, 0.5, 0.5, 0.5] * 2
times.shuffle.each do |t|
play scale(:c4, :minor).choose
sleep t
end
end
clever solution. Perhaps better as a live loop so it can be used with other bits.
I played both solutions (so far) together. Sounded nice.
live_loop :test do
times = [1, 0.25, 0.25, 0.25, 0.75, 0.5, 0.5, 0.5] * 2
times.shuffle.each do |t|
play scale(:c4, :minor).choose
sleep t
end
end
live_loop :test2 do
play scale(:c4, :minor).choose, amp: choose([0,0,0,1])
sleep 0.125
end
a = [0.125,0.25,0.5,1]
t = 0
live_loop :a do
play scale(:c4,:minor).choose
sleep b = a.choose
t +=b
puts t
if t >=15
play scale(:c4,:minor).choose
sleep 16-t
t = 0
end
end