Synchronous sample call

Is it possible to execute an instruction after the sample call stops playing completely?

For example

live_loop :example do
    sync_sample :ambi_drone, rate: 0.2
    puts 'sample stopped playing, sleeping for 1 second now'
    sleep 1
end

Is the only way of doing this using sleeping for the “sample_duration” with the same params you pass to the sample call?

Thanks!

You can just pass the same params to the sample_duration call, like this:

live_loop :example do
  sample :ambi_drone, rate: 0.2
  sleep sample_duration :ambi_drone, rate: 0.2
  puts 'sample stopped playing, sleeping for 1 second now'
  sleep 1
end