Read thousands of peek~ values from a buffer in no time

Luca De Rosso's icon

Hi there!

I need to read a big number of values from a buffer at specific intervals. I need around 262,144 or more, assuming of course that the number of samples in the buffer is >= than the number of values I need.

I tried to bang the buffer with a uzi set at 2500 (way less than I need). It works but it's so slow that it made me think I'm not using the right approach. I feel like there must be a way to print out all the values of a buffer easily but I can't find it.

Any ideas?

ldr-04_sound-patterns.maxpat
Max Patch
Christopher Dobrian's icon

I'd say that your single biggest "bottleneck" is the fact that you are redrawing the matrix in the window on every single number. There's no need for that. Remove that and see if that improves your speed sufficiently. I see other ways you could probably improve efficiency, but that's the big one, so you should fix that first.

Luca De Rosso's icon

Well I guess that tells a lot about how much I know about jitter : )
I tried id with and uzi at 242144 and it works great! I've attached the updated patch for reference.

Thank you so much Christopher.

ldr-04_sound-patterns-2.maxpat
Max Patch
Jesse's icon

jit.catch~ will be helpful here.

Christopher Dobrian's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I'm glad it helped! Here's a version of your patch with a couple things done a little differently. Not necessarily any better than what you did, just slightly different ways of doing the same things.

Luca De Rosso's icon

Yeah I think your version is more elegant Christopher. I think I'll adopt it for my project. Thank you for sharing.