how to Trigger object when the bang is off vs on

tsiwt's icon

Hello this I feel Is somewhat a simple question. but haven't been able to solve it. I don't understand very well
how the if statements work in max msp.

I have a gate object that outputs a number that is going from 0 to 320 in various sequences, if I attach a bang to the same outlet the bang stays On if the number is moving , as soon as the number stops moving the bang turns off. This is great.. my question is what object do I need to detect the bang when it turns off and detect it when it turns on

so I can trigger different events when the number stops moving(bang off) from when the number is moving(bang on).

thanks for the time.

Roman Thilenius's icon

oh je. ^^

a bang in max is nothing but the message "bang", just like the
message "hello" .. it does not turn on and off ... unfortunately
many newbies are mislead from the [button] object´s behaviour.

what you want to use to find out about the densitiy of incoming
events is the [timer] object (in conjunction with [if] or [==] when
you want a true false output for activity.)

[timer] is not easy to use at first but it is worth the hassle.

-110

tsiwt's icon

thank you

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

here's a solution which doesn't use an expression or a timer, just some conditioning using [maximum], [-1], [select] and the inevitable [onebang]; selecting peaks and troughs is a common head-scratcher and has eluded me for some time so i'm glad you posted this question; some may find this one a little convoluted, but it's as minimal as i can make it:

Brendan

878.startStop.jpg
jpg
brendan mccloskey's icon

ps
for better functionality on startup, the [onebang] object on the lower right should NOT have the argument '1'

ooops

tsiwt's icon

thanks very helpful

gusadel's icon

Great solution Noob_Meister !