How to make a double tap(click) button for monome
I'm building a monome style controller with my launchpad, and wondering how to make a button, that when pushed quickly twice, will perform a different function, than if pushed once.
Apologies if this has been discussed on the forum before, but I couldn't find anything when searching "double click" or "double tap".
This is a good spot for thresh:
a "triple click" too...awesome.
Can I also make a "hold button" with thresh, that will perform a different function when the button is being held?
So you're looking for a 'tap, doubletap, or press/hold' type thing? I had something like that setup for arduino stuff. I would imagine it's not much different from the code above. I think the problem with using thresh is that you add a constant latency (ie the normal 'tap' won't 300ms in the example above, which is quite slow/unresponsive. If you bring that number right down (to 50ms or so) it's nearly impossible to get it to register a 'double tap'.
You can have stuff be triggered by the button release as most of the time you release after pressing. That way you can use timer that checks how long between button press and release and if it's over something short, then it's a press and hold (or double tap etc..)
Thanks again to Ben for the patch.
And thanks to Rodrigo for the great info. Now I can at least use the right terminology. Thanks for the tip about latency, I'll make sure it controls something that is not dependent on low latency.
BTW, the Party Van looks like amazing. Should it work with a Launchpad too?
I plan on putting something like this together as I need it for some Softstep programming, so when I do I'll post it on this thread too.
Thanks. It should work as long as it's compatible for serialosc (not sure how the emulation stuff works). You can map just about everything to MIDI control though, so there's always that.
I love that use of [thresh] to detect between single/double/triple taps! I had been using a [timer] into a series of [split]s, but this is much more graceful this way.
Here is an expanded patch, incorporating that use of [thresh], but also adding detection of long/held button presses.
This patcher takes MIDI velocity in, so any non-zero number is treated as a "button down" message, and any zero is treated as "button up".
It has 5 outlets that it will bang, respectively, for: single tap, double tap, triple tap, long hold (trigger ASAP), long hold (trigger on release).
The long hold (ASAP) outlet bangs as soon as the "long hold" interval is reached (500ms by default). The long hold (on release) outlet bangs only once the button is released.
Depending on what function the long hold is mapped to, you would want to use one type of trigger or the other. If you want to time an event to something musical, you'd want to use the long hold (on release) outlet, so you can lift the button right at the precise moment you want to trigger an event. But for something more "admin", like resetting a parameter, or jumping to the top of a list, you just want it to fire as soon as it knows you are doing a long hold.
(For non-English speakers, "ASAP" is short for "as soon as possible".)
cheers,
Leigh
That's quite elegant!
Here's an expanded version of my patch above. As Rodrigo points out, the drawback to a patch that detects double taps is the latency (in this case, 300ms) that it adds to registering single taps.
In this patch, I'm passing single-tap triggers out through two different outlets. One sends an output bang immediately when it receives an input (button down), and the other sends an output bang only once the 300ms window has closed with only one bang (which I call single tap confirmed).
If, however, the patch detects that a user is actually making a double-tap or a "long hold", it sends a "cancel single tap" message out. So, the immediate version has no latency, but its truth is tenuous.
Therefore, choose wisely whether to use the single tap (immediate) or single tap (confirmed) outlet. The basic rule is, if you can't undo whatever action you would start with a single tap, only use the confirmed version of the single tap.
cheers,
Leigh
But how do you map the UMI3 to it given known issues with Live.Button?
Another thread: Live Button is Tempermental
Seems to me the Live.Button ignores the "Note Off" message. You can work around it with a feedback loop for the click and double click, but that won't work for the tap and hold.
Sorted it: notein and sel 60 62 64 (for C4 D4 E4 coming from the Logidy UMI3 - I have one as well). Works great. Thanks so much.