Gating a midi control data stream?
Hi All,
Please forgive me if this is an obvious question, I'm fairly new to Max.
I have a stream of data coming from an arduino and into MAX, then triggering scenes in ableton. NB I'm not using M4L, I'm just sending ctrlout messages as either 127 or 0 to launch different scenes in Ableton depending on what the sensor value is. This is working.
The problem is the scenes keep re-launching every half-second or so, because they are getting a constant stream of midi cntrl messages. I need some way to let either a single message through or just gate the stream so it sends 127 for a say 200ms and then back to 0. This will be enough to launch the scene and not then to re-trigger it.
By the way I have tried onebang and gate but without much success, and i think its because of my newbie-ness. If anyone has any objects or advice I'd be very grateful. Will post my patch if that would help.
Thanks for your time
Mike
Yes, posting the patch would help to understand what exactly you're doing.
One object that may be useful for you is [change], which only forwards a number passed into it, if it has changed since the last number was received.
If you want a gate that only lets a single message/number through, after which it closes until you tell it to accept another value, you can do something like this:
Click on the [1] message to open the gate. Then you can send one value through the gate, after which it automatically closes again, until you click on [1] again.
In other words: This is identical to the behaviour of [oneclick], except that it passes messages instead of bangs.
(And of course the opening of this gate can be easily automated as well.)
If you just want to limit the speed at which messages get passed through, take a look at the [speedlim] object. [speedlim 1000], for example, would only let through new messages once per second.
Many thanks for the tips - I'll try these out.