Turn on a button for X seconds

Discuss Lemur and share techniques.

Turn on a button for X seconds

Postby Westbam » 03 Nov 2017 16:30

I am have some effects, that really only need to last a few seconds. And I if I forget to turn it off, well, lemur can do that for me.

But I am not able to turn a button of after X amount of time.
I tried to make it with a canvas overlay, send to front, to catch the clicks.

I figured I made 2 expressions, one on "On cursor Down" to make X 0 or 1, and Catch the time on that press, and another on that is set 'On Expression x==1' to see when my delay time is passed.

So far I have no success, really hope someone has a golden tip for me.
Posts: 5
Joined: 13 Nov 2016 21:10

Re: Turn on a button for X seconds

Postby MrCorba » 06 Nov 2017 08:53

To get a button to react after x seconds, you need a few things:

- An expression that is set to the current time, when the button is pressed => timePressed = currenttime
- An expression that calculates the delay => delayPassedcurrenttime - timePressed > delayTime
- An script that listens to that expression and react if it evaluates true => delayPassed == 1

I've attached an example. It has a lot of extra objects to show the above logic.
Button Reset.jzml
(4.46 KiB) Downloaded 11 times
"Having no silence in music is like having no black or white in a painting" - Brian Eno
Posts: 143
Joined: 02 Sep 2013 20:17
Location: Netherlands

Re: Turn on a button for X seconds

Postby Westbam » 07 Nov 2017 01:49

Wow, I think I understand it, and learned some new tricks about the scripting.
So the expressions keep on monitoring the values, regardless if you do anything with the button.

Thank you soo much, spend too much time in trying to solve this one.
Posts: 5
Joined: 13 Nov 2016 21:10

Re: Turn on a button for X seconds

Postby Macciza » 11 Nov 2017 02:56

It is also possible to use a Pad and adjust the behaviour parameters and message timing to achieve a delayed turn-off
It can also be used as a ramp up/down if controlling send/return volume rather then just being on-off..
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*]
Posts: 1325
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Return to General Discussion

Who is online

Users browsing this forum: Bing [Bot] and 5 guests