I’ve been trying to build up my experience with making drum patterns with Sonic Pi. Would you please help me understand how to create consistent patterns across BPMs?
I was watching this video about drum patterns to try and replicate in SonicPi. In this case the Basic Rock rhythm seemed like a good place to start.
use_bpm 110 live_loop :buup do cue :boop sleep 1 end live_loop :seembal do sync :boop sample :drum_cymbal_closed, amp: 0.2 end live_loop :snahre do sync :boop sample :drum_snare_soft sleep 3 end sleep 1 live_loop :keek do sync :boop sample :drum_heavy_kick sleep 1 sample :drum_heavy_kick sleep 1 sample :drum_heavy_kick sleep 1 end
So in this snippet, we have a BPM of 110 and a cue beat that sleeps for 1 (beat?).
At 110 bpm, it seems to function as expected; 1 snare hit, 3 heavy kicks, 1 snare hit, etc. The closed cymbal triggers every beat as expected too.
However, here’s my problem, when I increase the tempo to 140 (for a faster, standard rock tempo) the snippet changes in function to: 1 snare hit, 2 heavy kicks, 1 snare hit, 1 kick, 1 snare hit, etc. It just sounds all sorts of syncopated.
From what I understand from the documentation, with sleep, “…beats are converted to seconds by scaling to the current bpm setting.”
Is there a way to constrain either the scaling or bpm to keep the code uniform but faster (or slower)? I hope it isn’t the case where I have to manipulate the sleep values depending on the BPM.