Hi all,
Does anyone know how I would go about changing the tempo for multiple live loops at once? Based on a few different post on this forum and the totorials, I’ve put together some test code that syncs three live loops to one master loop.
The loops stay synced if I start with them all commented out and add them in one at a time, as well as if I change any options in each loop once they are running. Unfortunately, when I try and use the method described above to change the tempo, the beeps often fall out of sync from the drums, sometimes to the point where they “disappear” entirely - it seems to be a function of when I re-run the code during the 8 beat :main loop. I’ve observed the problem when changing the tempo in the 60 - 90 bpm range.
use_debug true
use_synth :tb303
use_bpm 60
##| sleep 0.01
set(:bpm, current_bpm)
print 'current bpm: ' + current_bpm.to_s
##| set(:bpm, 60) # this doesn't fix the problem either...
##| print 'current bpm: ' + current_bpm.to_s
live_loop :main, delay: 0.001 do # delay solves the delayed start problem
print 'main loop'
use_bpm get(:bpm)
sleep 8 ### THE SLEEP TIME OF THE MAIN LOOP SHOULD BE >= ALL OTHER LOOPS
end
live_loop :beep, sync: :main do
print 'beeps'
use_bpm get(:bpm)
with_fx :panslicer, phase: 0.125, mix: 1 do
play 42, release: 0.48, amp: 0.3
end
sleep 4 # this occurs every 4 beats (on 1 & 5)... but can only start on beat 1 (of 8)
end
live_loop :snare, sync: :main do
use_bpm get(:bpm)
sleep 1 # on 2, 4, 6, 8... but can only start on beat 1 (of 8)
print 'snare'
with_fx :echo, phase: 0.125, mix: 1, amp: 1 do
sample :drum_snare_hard
end
sleep 1
end
live_loop :drum, sync: :main do
use_bpm get(:bpm)
print 'kick'
with_fx :echo, decay: 6, mix: 1, amp: 1 do
sample :bd_haus
end
sleep 2 # on 1, 3, 5, 7... but can only start on beat 1 (of 8)
end
Also, I don’t know if it has any impact on the problem, but when I run my code, I get the following warning:
{run: 612, time: 0.001, thread: :live_loop_main}
├─ Timing warning: running slightly behind…
└─ "main loop"
Does anyone have any suggestions on how to solve this problem? Or perhaps I’m not approaching live looping in the most logical way? Adding the “sync: :main” option to the live_loop definition (rather than inside the block) made the most sense to me, but maybe I need to rethink that technique…? I also tried using the “sync_bpm: :main” option, but that doesn’t help either.
Thanks in advance for your help!
Cheers,
-eric