Send Bang when when maximum value is reached.

May 21, 2013 at 2:06pm

Send Bang when when maximum value is reached.

As so often I need your help to solve a very banal problem:

A Stepper-Motor controller sends out the position eg. 856. If the motor stops and turns around in the other direction it goes 855,854 and so on..
I want MAX to BANG if the maximum is reached (here: 856).

How ca this be made easily?



May 21, 2013 at 3:07pm

[select 856]

May 21, 2013 at 3:20pm

Yes, but the numbers is just an example.
At least I need to trigger the counting peak which alters.

May 21, 2013 at 3:55pm

Ah, so you don’t know what the maximum is, you just want to know when the direction changes?

[change -] and [change +] indicate direction. A little work will have to be done to capture the maximum number, as this reports after the direction has changed.

May 22, 2013 at 12:41am

In this case, change bangs when the Number is smaller than the number recieved before. But I want just ONE bang after the maximum value is reached.

May 22, 2013 at 1:04am

There’s an off by one error on the high number, but this gives you the bangs:


– Pasted Max Patch, click to expand. –


May 22, 2013 at 4:33am

Thank you.. this seems to be what I need.

May 22, 2013 at 4:36am


May 22, 2013 at 5:55am

If you know the peak value you’re looking for, you can use sel or >= or peak or past. If you’re just looking at a stream of data coming in in real time and you don’t know what value you’re looking for, then you can only report that a peak has occurred after the peak has been reached, once the input value has started to decrease. This abstraction does that.


– Pasted Max Patch, click to expand. –



You must be logged in to reply to this topic.