I’ve been wanting to do more IDM kinda music lately, got into ableton live, but drawing midi is boring and I’m super bad at playing drums on a midi controller or coming up with good patterns in the first place. So here comes sonic pi to the rescue!
I came up with a pattern I like and will be sending it via midi to ableton to experiment with. But I wanted to se if I could do some beat repeat directly in sonic pi. I found a thread by @sub_repeat but I could not reply, maybe it’s locked or patreons only.
Some people on the tread did not rally understand what @sub_repeat was looking for. So here’s an example:
like any IDM or aphex twin track the beat pattern usually jumps all over the place, have a listen:
So each kick or snare and the like sometimes “glitches” and repeats every like 16th or 32th. This effect is called beat repeat. Usually is controlled by probability, you’d have a simple drum pattern and each hit would have a random chance of “glitching out” or repeating.
I’m not sure the solution I came up with is the best that could be done, so I wanna ask here to the sonic pi wizards. I made this code as a proof of concept:
yesnorepeat = 0 #This variable will turn beat repeat on and off if value is 0 or 1
live_loop :debug do #prints out the value of yesnorepeat
puts yesnorepeat
sleep 0.5
end
live_loop :beatrepeat do #here the magic happens
sleep rrand_i(1,16) #waits a random amount of time to start the beat repeat effect
yesnorepeat = 1
sleep rrand_i(1,2) #waits random amount to stop the effect
yesnorepeat = 0
end
live_loop :snare do
if yesnorepeat == 0 then #if beat repeat is off then play this pattern
sleep 0.5
sample :bd_boom , cutoff:100 if spread(2,4).tick
else #if beat repeat is on play the same sample every 0.1 seconds
sleep 0.1
sample :bd_boom , cutoff:100
end
end
With my method you would have to set up a separate beat repeat live loop for each kick, snare, tom or hi-hat for them to glitch out independently. And you can simply change the random values on the beat repeat live loop to increase or decrease the probability of the effect.
So yeah, is there any way I can improve my code or any of you know more IDM tricks?