Eliminating double triggering
Hi – I’m new to Max MSP and am trying to find the best way to do the following: I have a midi device that is sending midi into the computer, and occasionally it double-triggers. Is there a way to set up hysteresis or use some other method so that there is a short time threshold that applies to stop repeated notes from triggering – in other words, I’d like the system to play the first midi note it receives, and then ignore the same note for say, 50 milliseconds for example. I suspect this might have something to do with the speedlim command or something – otherwise is there a plug in or a pre-existing max app that I can use that will stop this doubletriggering? Thanks very much for your help!
Thanks pid – can you be more specific? I’ve also just noticed the sensor-tamer. Is this a better way to go?
just load thresh and quickthresh into a patcher and look at the help and ref files – it is all very simple and they explain better than i could. sensor tamer is an abstraction that would interesting look inside of, sure. but what you need to do is very achievable with the aforementioned objects.
I tend to use this (there may be a better way) – I believe this is quicker than thresh, because the bang you want goes straight through with no delay.
If you want to use messages other than bangs in, put a [t b] in front of the delay to transform any message into a bang..
----------begin_max5_patcher---------- 418.3ocuTtsbCBBDF9Z8ofgqsYDPpwdWeN5joiGnIzQwLQbZZyj28pKZSsGM d5FY1kU3+6GVNYagixOJJvn6POfrrNYaYAopSX0DagyBOFmFV.kgiJ05bE1w LUdoNUn0utWXVCbTnZKFsoY58g53cR01GOHh0lJXdtqbcPTBAFba+9w+nJyj ppEE1NxkjlspSVYBHo7nmuI.Wm5rsc8GmkhEF.Q.aRQweHnnDuT8usnnEGAI h0H21bOkqzpvL.N78Gjgo+J3Rk9O4lxLDSWCCdeC758pP9FrdDZ0ziwO3Spe PlC+fudA8C1D5GIhTDeHWQ92diVOwEZK7XCxSn80SnSnmrMTKPjAcQoONBgC OZv8lWGg7YGA1BbpT8025AYVmuqMUjWdHtEJyp4ftHzDQgVpB0xpGOuTSPmZ 1ISRDvzsbjIS1mW0J0HAzle7HquJxuGJpV0jESQ7dpnqvindzU7paI7l2aCf gNQDOeH5V+5JgnQxQeNq4WIGMpasA.CUPzH0JaF7biVoMMnsdt2r54zdvAaQ 6u5ys.5HTTUvY62AoakWx. -----------end_max5_patcher-----------
Or – if you look at the sensor tamer abstraction – you only need the debouncer subpatch. This does the same thing with one less object, but would be slightly harder to adapt to other messages. In fact – it’s possible you could do it in just two objects (the onebang and the del(ay)…
A simpler solution using onebang:
----------begin_max5_patcher---------- 391.3ocuTtjaCBCDFdMbJr7ZZjswPncWOGUQU7vMwUfMBLpoMJ28hGfjPTSH sMIar0Ld7L+ymerw0AmnWKpwnmPufbb1353.trNb5scvEwqSyiqgvvIMFiVg 85VR0THU4BCrFs2YYrIckTs70JQpoK29OxmQ7PrvHXhLLhVrOQ5FywYpyk4y RQWZvIwpk3caRlARRm79C7AEUVIpEJSrQpUGH.97.nl9vDoe.svtostt1Aua LA7sEk5SuQDHbJBDFBBfN+eS.k3i1JNTOiXMTBblHGEP9QvvNMX3LPWrNcw8 u5fIZPQuoUFUbArA7yUx37IPV+YFiwGirCxWs7KHeT1Lx0ijZkv1NH5uElC2 x5tsGNeBXxNKL8NCTojoo5Y3CjRbtTc7mOPOY8OFZ05lpzAw0enh12UYhZiT AGeGDiUiH5tfVIyxDv5jdOExrRsTY50.u8ygfVdwgKj7ntWpirng.X4ADajf 0IdAcoMBHxo5jwc6jMx8PR76pjBuzi6+pjZM159MU7nmT. -----------end_max5_patcher-----------
Wouldn’t it be an idea to use [speedlim] here, in order to make sure you always have the correct last value sent through, even when the midi signal ‘bursts’?
in the triggering i have in my patch, i have a delay you can set before another trigger is possible. it is just done with a gate, where triggers can only pass through the gate to be received when the gate is open. when the first trigger is sent, it passes through the gate and immediately closes it. you then have a delay which you can adjust the time of, after that time has elapsed a bang is sent to open the gate again, at which point a second trigger can pass through. this may not be the most straightforward way to do it, but it works fine if all you want to do is say prevent 2 triggers within 50ms (or any other value).