how to Trigger object when the bang is off vs on


    Jul 28 2010 | 5:26 am
    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.

    • Jul 28 2010 | 6:34 am
      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
    • Jul 28 2010 | 8:31 am
      thank you
    • Jul 28 2010 | 4:42 pm
      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
    • Jul 28 2010 | 4:49 pm
      ps for better functionality on startup, the [onebang] object on the lower right should NOT have the argument '1'
      ooops
    • Jul 29 2010 | 1:31 am
      thanks very helpful
    • Oct 11 2013 | 5:36 pm
      Great solution Noob_Meister !