Pause a sample?


Do you think is it possible to get a pause system for samples ?
i mean i play a sample, i push a pause button from an interface, the sample stop playing, then i click again on the pause button and it plays again but not from the start from the position when i paused it,
Seems a bit hard no with sonic Pi ?
Thanks for ideas, thoughts

A little bit more work than other things perhaps, but you could potentially do something very similar to that at least. You’d need to record the start time when the sample is triggered, stop the playing sample when asked, and record the stop time. From this you could deduce the position in the sample to restart playback, and play a new instance of the sample from the required start point.

yep but how to get this info ?

Depends - are you receiving an OSC or MIDI signal as the trigger? if so then you can just use from Ruby in the event loop.

interesting maybe some dudes have always written about that gonna search on this forum :wink:
thnaks for your answer, it’s always a pleasure to have access to some clever people