Forums > MaxMSP

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

Feb 12 2010 | 7:28 pm

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

-- Pasted Max Patch, click to expand. --

Feb 12 2010 | 7:43 pm

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.

Feb 12 2010 | 8:36 pm

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.

Feb 12 2010 | 8:43 pm

@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.

-- Pasted Max Patch, click to expand. --

Feb 12 2010 | 9:15 pm

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.



Feb 12 2010 | 10:20 pm

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

-- Pasted Max Patch, click to expand. --

Feb 12 2010 | 11:12 pm

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

Feb 13 2010 | 3:03 am

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

Feb 13 2010 | 7:27 am

@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

Feb 13 2010 | 8:48 am

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. :-)

Feb 13 2010 | 9:10 am

-- Pasted Max Patch, click to expand. --

Feb 13 2010 | 7:41 pm

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

-- Pasted Max Patch, click to expand. --

Viewing 12 posts - 1 through 12 (of 12 total)

Forums > MaxMSP