force [maximum] or [peak] to report maximum only?

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hallo board
I've been experimenting with various Max objects/tutorials, to try to get a report from an object or patch that outputs ONLY the maximum value from a stream of continuous controller values, which always begin at zero. So, stream#1 = eg, 0-56-0, report ONLY 56, stream#2 = 0-121-0, report ONLY 121.... [maximum] and [peak] report all numbers past the previous peak...here's the patch I've begun, but i can't see the answer....all suggestions gratefully accepted

MIB's icon

I might be wrong, but that seems to be only possible if you know in advance what your highest number is going to be. In that case just give peak or maximum that value in the right inlet, or even better, use select instead.

Chris Muir's icon

The only peak exactly _when_? All the other numbers that peak and maximum report _are_ the peaks, when they arrive. If you want to query for a "report" of the peak, you could use int to buffer the result of peak until you query.

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.

@chris; this sounds convincing, but i'm not sure how to implement [int]; here's a solution that either yourself or Andreas Wetterburg suggested some time ago... I'm using an FSR as a velocity sensor via Arduino, so the incoming values are a little erratic (but i can sort this myself); all i need is, whenever the incoming values move beyond zero, assess the incoming values and report the maximum; regardless of timeframe. So 0-45, over 20ms or 2000ms will still report 45.

AlexHarker's icon

Define maximum better to make this question easier to answer.

Maybe describe an incoming input stream and what you would expect to be output.

Or to put it another way, there could always be another value coming later that is bigger than any of the previous values - therefore you can never know that you've reached the maximum and you will never have an output.

Perhaps you could start by considering whether you mean a value that is the highest of a set of values, or a value that is higher than it's immediately surrounding values (a forming a visual peak if you were to draw graph)

There seems to be more to this than you're telling us - don't leave us to guess - help us to help you.

Cheers,

Alex

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I think that the problem is still somewhat ill-defined. Do you really want the highest number achieved until they start going down again?

brendan mccloskey's icon

dood, i knew i could count on you...despite the fact that i hadn't been explicit about the required functionality, this patch is EXACTLY what i needed, thanks a million

tdaeik's icon

yep, thanks!! this is precisely what i needed as well.

Phijel's icon

@chris: nice patch, but I think the peak object is useless in your example, it works perfectly without, by connecting the left output of bucket to the int

Chris Muir's icon

Yeah, you're right. I should have started fresh, instead of modifying the starting patch. I managed to throw most of it away, I should have kept going. :-)

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.
Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

And at the risk of beating a dead horse, there was a L2R dependency in that last one, that is fixed in this one: