[PD] checking [readsf~]'s current position in wav-file
reduzent at gmail.com
Wed Nov 20 08:52:52 CET 2019
On Tue, 2019-11-19 at 21:39 +0100, Jakob Laue wrote:
> Hey all,
> I want to play a wav-file with [readsf~] and I want to loop the wav-
> This can easily be done by connecting [readsf~]'s right outlet it its
> The problem is that I have a metronome in my patch which is the
> master of the tempo.
> The [readsf~] object will get out of sync with the metronome when it
> loops the same file over a longer period of time.
> That's why I want to constantly check the position of the wav-
> file that [readsf~] is currently at, when it plays the wav-file.
> By this, I can restart/loop the wav-file in sync with the metronome,
> as soon as it has almost reached its end.
> Do you have an idea how I could do that?
You should definitely start each loop in sync with the metronome. It
seems you're letting [readsf~ ] playback loop itself by using the end
bang to trigger playback again. This is not wrong, but if the length of
your soundfile doesn't match exactly a multiple of your metro period,
then metro and loop playback will drift apart.
Pd is absolutely deterministic. There is no need to ask [readsf~] for
the current cursor position. You can derive it from the time that has
passed since you started it. But even that would only be necessary if
you have user input and you want to determine current playback position
at time of user input.
If my assumption is correct that in your patch playback and loop
lengths are predefined, you could simply play the portion of the file
that exactly fits into a multiple of your metro period. You should then
use the bang from metro to retrigger the start of the playback.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 488 bytes
Desc: This is a digitally signed message part
More information about the Pd-list