Sync loops of differing lengths (trim longest)

Hi! Just wondering about something that I was wondering about…

sync lets you ensure loops start together :+1:

If you have two loops of different lengths, and you want them to start at the same time, trimming the 2nd loop so it’s not played in entirety… is that possible in SP?

EG: sample 1 is 4 seconds, sample 2 is 2 seconds

  • loop 1 (playing sample 1) syncs with start of loop 2 (playing sample 2)
  • when loop 2 finishes and starts again, start loop 1 again, trimming (or silencing) remaining 2 seconds

If yes, what methods can be used?!

eg would you have to use the start and end ?
(to set the length of sample 2 to use, from sample 1)

or could control and stop be used ?
(to stop loop 2 when loop 1 finishes)


I’d prob just use start or finish for the first sample. however, figuring out how long for each sample to sleep could vary in difficulty depending on whether you have samples that are an even amount of seconds and easily divisible by one another or if you are using beat_stretch. If not, that could be harder to figure out.

Here is an easy version of how it can be done

live_loop :one do
  sd = sample_duration :loop_garzul # sample is 8 seconds
  sample :loop_garzul, finish: 0.5 # trims sample to be 4 seconds
  sleep sd/2.0

live_loop :two, sync: :one do
  sample :ambi_drone, beat_stretch: 4 # sample is 4 seconds
  sleep 4