Button Press Length


#1

Hi everyone,

I'm trying to find a way to distinguish between long or short button presses from a momentary toggle. Basically like the sss/ctrl/buttonFunctions object or the rbrt/control/click hold objects. These ones don't seem to be function correctly....


#2

If you are going to try from scratch, then its just a matter of measuring the time the button is pressed. The Timeri object can do that, and it can release show the value when you depress the button, then it is just a matter of conditions to action depending on length.
With the timeri, you just need to convert your bool trigger from a falling edge to a rising edge when connecting to the stop input. When stop is triggered, it will display a krate value from the green output that represents how many krate samples passed between start and stop.
Maybe this can help you get started.. :grin:


#3

Oh i understand thanks!


#4

hi!

I can't use any of these functions for what I want to do. They all depend on the release of the button to spit out the time the button was held, but I want my button to react while the button is being pressed.

is there a "live" time counter?

sss/ctrl/buttonFunctions has the "loopupdate" output that triggers every time the time counter resets to 0, if the input pulse is long enough, but it's not convenient since it also triggers at the beginning of the pulse that starts the timer in the first place...I could work around this but I'm pretty sure there's a more simple workaround.


#5

Thinking outside the square a little here, why don't you try using a counter object with a multiplexor, the longer you hold the button down the further the counter will count and depending on the count value the multiplexor will respond to.
:grinning:


#6

hey!
the counters I've used only count when the pulse is initially received, not when it's held down.
what you describe is exactly what I need, but I can't seem to find any object that does that.


#7

You'll need to play around with several objects to get the action.
I'll try and have a look at it for you..
May need to code an object to count and hold values etc.


#8

Maybe this can help take you in the right direction.
I mocked tghis up with factory objects so you can put it together yourself and tweek it how you want.

Basicaly the idea is, only when button_1 is pressed will the lfo pass through to the counter, and on the rising edge of pressing button_1, the counter resets. In this setup though, if you hold it for too long it just loops back to the first one.

Let me know how it goes.
:grin:


#9

thank you gavin!
that's a clever solution.

this worked for me:

the saturating counter does not reset by itself - releasing the button does.


#10

Cool, :wink:I like your use of the inverter to reset on the falling edge.