newb question - cross threshold single bang

berko's icon

hopefully this will be simple. i have several controllers i use that give continuous data (a wiimote, an iphone). when that data crosses a certain numerical threshold I want to send a single bang.

Essentially I am using this for midi note on messages.

Any help would be greatly appreciated

berko's icon

yeah, but that sends a bang for every message above the threshold - i just want one bang when the number crosses that threshold and one bang when it goes below it.

I might be able to do it with this and then a change object?

brendan mccloskey's icon

if you only want one bang......use [onebang] :)

precede it with [sel 1] tho,

Christopher Dobrian's icon

See the "past" object.

broc's icon

input --- [> 64] --- [togedge]

berko's icon

yes the past object works incredibly well. solves my issue entirely. thanks

zangpa's icon

Is there an object for the opposite of "past" - sends a bang when numbers go below a threshold? Can't seem to find one.....

brendan mccloskey's icon

I'm not sure; you could just invert the input to [past] using [!- N] where N is the maximum of your input? Or is that a bit clunky. There are [peak] and [trough] also.

HTH
Brendan

zangpa's icon

Thanks! Think inverting will do. Read about Peak and Through, but past fits the patch better. I'm turning on and of a toggle when sensor values goes above or below a threshold. Anyway, thanks for this pretty simple, but good solution.

brendan mccloskey's icon

yeah, [past] is perfect for this, [peak] and [trough] were a bad suggestion, broc's suggestion of [togedge] is the most minimal and flexible solution; my method only works if your threshold is in the centre :(

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

Brendan