Reversing the content of a buffer?
Is there any way to reverse the content of a buffer~ immediately?
Thanks a lot,
Masa
Not immediately. You could send up a gen patch that did this with a for loop pretty easily. for example:
for(i = 0; i < length_of_buffer < i += 1){
sample_to_write = peek(buffer_name,i,channel);
poke(buffer_name,sample_to_write, length_of_buffer - i,channel);
}
You could also do this with standard max objects, but I've been loving gen lately, so that's my solution.
You can also use [mxj buf.Op myBuff]'s reverse method.
try el.buffet~ object. It does all buffer tricks very fast.
http://disis.music.vt.edu/eric/main/wp-content/uploads/2016/06/LyonPotpourri-3.0-Package-06132016.zip
Thanks a lot Evan. As I am not familiar with gen~ yet (definitively I would love to be), is it the 'codebox' I need to put your code into?
Thanks a lot Patrick. I will look into the mxj object.
Thanks a lot SOURCE AUDIO, being 'very fast' helps a lot. I will try the object.
SOURCE AUDIO, do you happen to know if there is the Windows version of LyonPotpourri 3.0 Package? I use both Mac and Windows.
There was a release for windows, but only 32 bit.
http://disis.music.vt.edu/eric/LyonSoftware/MaxMSP
But if You have time You could try to compile windows version from the source.
https://github.com/ericlyon/LyonPotpourri3.0-MaxMSP
in many situations you would just read out the buffer reversed but leave the content as is.
Thank you SOURCE AUDIO.
Hi Roman. Sure, the reason I am trying to reverse the buffer content is to remain at the same playback position when reading the content in reverse (with the signal of -1).
In that case, you might want to just calculate the index when you hit reverse, and start reading backwards from there, instead of reversing the whole buffer. Likely much cheaper computationally.
Or have two copies of the buffer, one reversed. But that doesn't seem necessary.
Thank you Evan. I didn't know that groove~ can receive index value. Or are you referring to another method?
[mxj buf.Op myBuff] simply did the trick. Thanks a lot all.