drumminhands But how do I modify so that it plays a sound file once, all the way through, and it not interruptible until the sound has finished?
In [pd playRetrig], a [phasor~] is used to generate a sawtooth, whose range is expanded to cover all the indexes in the array and sent to [tabread~] that reads the table at a variable speed. You have several options:
- if you want to read the file at the original speed, do not use
[tabread~], instead simply send a bang into [tabplay~].
- if you want to read the file once at a fixed speed that may be different from the original, send messages to a
[line~] object to generate a single ramp and connect its outlet to [tabread~]. E.g.: [0, 100000 2000] will read 100000 samples in 2000 milliseconds
- if you want to read the file once at a variable speed, I think you need to keep the
[phasor~] approach (as that allows for continuous modulation of the playback rate) object to generate a single ramp and then "turn it off" once it ends. To turn it off, you can do something like this hack to set the [phasor~]'s frequency to 0 when it is towards the end of the ramp:

Note: in the above screenshot, the phasor~ is stopped at some value between 0.999 and 1 so it doesn't accidentally restart before the [threshold~] has triggered. This means playback won't reach the very end of the file (less than the last 0.001 will be missing). Full-length playback can be achieved with a bit of extra work.