Turn on a button for X seconds

Discuss Lemur and share techniques.
Post Reply
Westbam
Newbie
Posts:5
Joined:13 Nov 2016 21:10
Turn on a button for X seconds

Post by 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.

MrCorba
Regular
Posts:143
Joined:02 Sep 2013 20:17
Location:Netherlands

Re: Turn on a button for X seconds

Post by 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.
Attachments
Button Reset.jzml
(4.46KiB)Downloaded 132 times
"Having no silence in music is like having no black or white in a painting" - Brian Eno
https://soundcloud.com/mrcorba

Westbam
Newbie
Posts:5
Joined:13 Nov 2016 21:10

Re: Turn on a button for X seconds

Post by 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.

Macciza
Regular
Posts:1325
Joined:07 Dec 2011 04:57
Location:Sydney, Australia.

Re: Turn on a button for X seconds

Post by 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..
cheers
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[*][/b]

Post Reply