Which is the recommended way for ‘startpos’ in PlayBuf.ar when Buffer’s sample rate is different from the server’s?
Let’s assume that “aTestFile.wav” has three channels and its duration is 10 seconds:
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/aTestFile.wav");
I want to start playing it at 3 seconds.
The shortest and most straightforward way seems to be as follows:
x = { PlayBuf.ar(b.numChannels, b.bufnum, BufRateScale.kr(b.bufnum), startPos: 3 * b.sampleRate, doneAction: Done.freeSelf) }.play
The following way seems to be a bit weird, but it works:
y = { PlayBuf.ar(b.numChannels, b.bufnum, BufRateScale.kr(b.bufnum), startPos: 3 * BufRateScale.kr(b.bufnum) * SampleRate.ir, doneAction: Done.freeSelf) }.play
Which way could be referred to as a standard one? The first one seems better for me because the code is shorter than the latter.
Best regards,