PlayBuf negative rate argument not working

Hey there,

I’m trying to play back buffers reversed - and somehow a negative rate argument in PlayBuf doesn’t work for me.

b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav"); 

//works
{ PlayBuf.ar(1, b, BufRateScale.kr(b) * 1, doneAction: Done.freeSelf) }.play
// silent
{ PlayBuf.ar(1, b, BufRateScale.kr(b) * -1, doneAction: Done.freeSelf) }.play

I’m on SC 3.13 rc01 on Mac OS. Any ideas? :~)

All best,
moritz

Try setting loop to 1 (true) or start with the file position at the end.
Hope that helps
Josh

/*
Josh Parmenter
www.realizedsound.net/josh
*/

2 Likes

The fifth argument startPos should be set in one of the following ways

{ PlayBuf.ar(1, b, BufRateScale.kr(b) * -1, 1, b.numFrames - 2, doneAction: Done.freeSelf) }.play
{ PlayBuf.ar(1, b, BufRateScale.kr(b) * -1, 1, BufFrames.kr(b) - 2, doneAction: Done.freeSelf) }.play

startPos starts at 0, so one should be subtracted.
Reaching the last frame of the but will free the synth due to the doneAction, so one should be subtracted again!

Compare with the following examples:

{ PlayBuf.ar(1, b, BufRateScale.kr(b) * -1, 1, b.numFrames - 1, doneAction: Done.none) }.play
{ PlayBuf.ar(1, b, BufRateScale.kr(b) * -1, 1, BufFrames.kr(b) - 1, doneAction: Done.none) }.play
1 Like

Thank you both! :slight_smile: