[PD] ring buffer with an array

Roman Haefeli reduzent at gmail.com
Tue Jan 10 10:25:48 CET 2012

Hi Alex

On Sun, 2012-01-08 at 16:33 -0200, Alexandre Torres Porres wrote:
> Hi folks, I'm trying to implement a ring buffer with a table for a sampler
> patch based on an array.
> But I'm having the hardest time cause it always "clicks" when I start
> writing back on the beginning of the array.
> I made this simple test attached below using metro. But I'm figuring the
> flaw is because is not trivial at all to keep control data in sync with
> audio blocks

I see two flaws with the same cause in your patch.

Both objects, [tabwrite~ ] and [tabplay~ ], execute the incoming
messages at block boundaries. Thus, your patch suffers from the
limitation that you intended to avoid by not using [bang~ ]. It does not
matter whether you use [bang~ ] or not, either way you cannot start the
[tabwrite~ ] recording between blocks. It's not possible with the
current implementation to make it record exactly every 2000ms (unless
2000ms is an exact multiple of the block size).  

The same applies to [tabplay~]. It does not take into account the
scheduling information of the incoming bang message and simply starts
playing at the next block start.

Because of above mentioned reasons I suggest to stick with [delwrite~ ]
and [delread~ ]. [delwrite~ ] is exactly what you are asking for: a ring
buffer. Is there a particular reason why you don't use those?


More information about the Pd-list mailing list