I’m using buffers 0 and 1 and I want to switch between them live. Each buffer plays correctly by itself (or when it is the first buffer played) but plays incorrectly when it is the second buffer played.
My strategy to switch buffers is that each buffer has a live loop with the same name :conductor
. When the buffer is run, :conductor
cues its live_loops, and overrides the cues from the previous buffer.
If you play buffer 0, then buffer 1, the :met2
live_loop plays for 16 beats then stops for 16 beats, then repeats that pattern. If you play buffer 1 first, it will continuously play :met2
.
#buffer 0
use_bpm 120
fifths = [:a4, :e5, :b4, :fs5]
live_loop :beat1 do
sync :conductor1
4.times do
play fifths.tick
sleep 4
end
end
live_loop :conductor do
cue :conductor1
sleep 16
end
# buffer 1
use_bpm 120
live_loop :met2 do
sync :conductor2
8.times do
play :e3
sleep 2
end
end
live_loop :conductor do
cue :conductor2
sleep 16
end
1 Like
I think your observed behaviour occurs because your live_loop lengths have a total sleep of 16 before they start waiting for the next cue to retrigger them. The cue is itself generated by a livel loop (:conductor) which has a total sleep time of 16. Thus there is the possibility of an indeterminate situation which can occur. The met2 and beat1 loops must be waiting for a cue (ie at the sync line) BEFORE the cue is generated by conductor. If it isn’t the cue will be missed and it will have to wait a further 16 before it is triggered by the subsequent cue.
One solution is to effectively remove or reduce the last sleep from each of the beat1 and met2 loops. Try using:
#buffer 0
use_bpm 120
fifths = [:a4, :e5, :b4, :fs5]
live_loop :beat1 do
sync :conductor1
tick_reset
3.times do
play fifths.tick
sleep 4
end
play fifths.tick
#no sleep here so loop goes to next sync straight away
#and is ready on time for the next cue
end
live_loop :conductor do
cue :conductor1
sleep 16
end
# buffer 1
use_bpm 120
live_loop :met2 do
sync :conductor2
7.times do
play :e3
sleep 2
end
play :e3
#no sleep here so the loop goes to next sync straight away
#and is ready on time for the next cue
end
live_loop :conductor do
cue :conductor2
sleep 16
end
In your original version the results MAY work (it did running SP4.5 on my MacbookPro) but may not.
1 Like
I tried what you suggested and it worked. The loops did have the same sleep so the loop starts could be muddled up. Thanks for the suggestion.
I was just thinking about the music and not the limitations of the software.