Tick reset upon laptop sleep - sorted

Hi
I am working on a beat repeat/stutter sample playback function, using slice: within a loop. When I first launch SPi and run this it’s fine. But if I change some parameters (.look to .choose, or the num value) and rerun it, it plays a slice from the middle of the loop before settling down to the ‘normal’ or expected sequence. If you copy-paste and run this it should work ok, but does it go out of sequence if you change some values?

use_sample_bpm :loop_amen

rmp = line(0, 7, steps: 8, inclusive: true)

puts rmp

/use rmp.look, .choose, rmp[3], e.g./

live_loop :stutt1 do
  tick_reset
  num = 8
  
  num.times do
    tick
    sample :loop_amen, slice: rmp.look, num_slices: num
    
    sleep 1.0/num
  end
  
end

PD-Pi

I made a slight change, which briefly allowed me to change stuff without upsetting ‘normal’ functionality, but it’s still ‘broken’:

use_sample_bpm :loop_amen

num = 8

rmp = line(0, num-1, steps: num, inclusive: true)


/use rmp.look, .choose, rmp[3], e.g./

live_loop :stutt1 do
  tick_reset
  
  num.times do
    tick
    sample :loop_amen, slice: rmp.look, num_slices: num
    puts rmp.look.to_i
    
    sleep 1.0/num
  end
  
end

PD-Pi

was not implying a bug or anything, my tick counter works fine, including normal or stutter playback, as long as I don’t close my laptop lid :wink:

PD-Pi