How to find minimum and maximum values in a buffer

i.m.klif's icon

Hi,

I need to find minimum and maximum values of individual channels of a buffer~.

So far I tried using javascript but am getting inconsistent values. Realtime measurements are out of questios because of the way the patch works. I would appreciate if anyone can help with this because, although I am using max for 30 years, my gen coding skills are zero.

Ivan

lennox's icon

I don’t know about gen. But I have been working on a similarproblem. I use a buffer to “store” transients generated by the aubio extension and want to cycle through them one at a time. I am uzi banging samples to [peek~] and gating the Uzi when I hit a >0. But I’ve been struggling with finding something smooth either aubio is making too many slices (doubling up?) or I still don’t have the right syntax for what I want yet.

my point is, oftentimes for this particular application I question why I don’t just use [coll] instead… a buffer is just an array so it’s almost the same thing… I just like the convenience of visualizing/zooming the buffer for what I’m doing and making my own gui would be pita. Imo vanilla arrays like coll or dict are way more powerful than what buffer~ can do alone, as convient am object as it is.

also it sounds like you should check out [change] or [thresh]?

florian1947's icon

good old mxj buf.Op

Max Patch
Copy patch and select New From Clipboard in Max.

i.m.klif's icon

Thank you Florian! That is it!

Lennox, thanks for your contribution. In a meanwhile I used minmax~ and play~ to play a sample once and get min and max values. As I use short samples this was a usable solution for me.

Ivan