Commands and conditions for starting and stopping (live_ ) loops

Hi, I’ve found a few different ways of toggling the status of playing loops :+1:
Before I completely break another wheel through unnecessary reinvention, I wondered if anyone else had any clean methods to achieve.

I know running loops can be modified, to comment play commands
I’m specifically interested in the cleanest, simplest methods people have employed, maybe something like @robin.newman 's example here (using kill with a trigger symbol), but maybe a bit (c)leaner

Thanks!

1 Like

sync :information_source:
This allows the stopping (sync = ‘scheduled pause’ ) of a loop
by toggling* the sync :metronome line (*comment/uncomment)

# key: bg1
# point_line: 3
# point_index: 0
# --
background = (scale :gs3, :minor_pentatonic)
live_loop :background do
  # stop
  sync :metronome
  use_synth :beep
  32.times do |i|
    puts "32 times! #{i}"
    play background.choose, release: 0.125, amp: 0.3, cutoff: 70
    sleep 0.25
  end
end

cue :metronome

Hope this helps!