Sync and the place into the code


Hi again,

Let’s try this piece of code. We have to declare the live_loop who trigger a cue to the live_loops we want to be synced after them.

# The importance of the place into the code

use_bpm 60
use_synth :piano

live_loop :name_of_live_loop_every_8_beats, delay: 1 do
  cue :_every_8_beats
  sleep 8

# ok every 4 beats the live_loop is played and it's a real pleasure
live_loop :foo_01 do
  sync :_every_4_beats
  play_pattern_timed [:c, :d, :e, :f] , 1

# this loop will be played for 4 beats then stop 4 beats
live_loop :foo_02 do
  sync :name_of_live_loop_every_4_beats
  use_octave 2
  play_pattern_timed [:c, :d, :e, :f] , 1

# this loop will be played every 8 beats then stop for 8 beats

live_loop :foo_03 do
  sync :_every_8_beats
  use_synth :prophet
  use_octave 2
  play_pattern_timed scale(:c, :major), 1

# the good place to be into the code AFTER the loop we want to be synced.
live_loop :name_of_live_loop_every_4_beats, delay: 1 do
  cue :_every_4_beats
  sleep 4



Hi @nlb,

I’m fairly certain wondering whether this is still due to the deterministic behaviour that Sam introduced in v3. In his comment on my github issue he stated that for threads syncing and cue-ing on the same logical time, what determines whether the cue or the sync happens first is the id of the thread. (This is, I suspect, could be why the behaviour is fine here if the cue-ing threads come after the syncing threads in the file, though @samaaron would be the one to confirm this. The reason I’m a little unsure is that I would think that thread id for a given live_loop would stay the same even if we cut and paste it into a different section of the file).


(I do also have to say that obviously there is a difference between syncing on a live_loop’s name vs syncing on a separate cue inside the same live_loop - exactly what is going on there I am not 100% sure about. So it’s definitely something that could be a bit clearer!)