reset to default

Discuss Lemur and share techniques.
Post Reply
Home Studio 87
Newbie
Posts: 37
Joined: 09 Jun 2012 16:51

reset to default

Post by Home Studio 87 »

hello can someone tell me how to make a button (custom or switch) with "double tap" to reset the value to default (ex pan to center or fader to 0db) ?
thanks
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: reset to default

Post by Phil999 »

the double-tap feature is a bit more complicated, but the reset feature should work with a Pads object and a script, executable On Expression x, and the line Knob.x=0.5, assuming the pan knob is bipolar. For the fader Fader.x=? where ? is the value that corresponds 0 dB. You can use a Monitor with Fader.x in the value field object to get that value.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
brianc
Regular
Posts: 87
Joined: 10 Jan 2012 02:16

Re: reset to default

Post by brianc »

To handle double taps with a pad, the pad has to keep track of how much time has elapsed since the last press. If that time hasn't been too long, it sets the value of the fader to 0 or 0.5, depending on polarity.

For the button (a pad), add a variable called last_pressed. Set it to 0 by default. Add this script to be executed On Expression x:

Code: Select all

if(x == 0) return; //don't trigger when the pad is released.

if ((time - last_pressed) < 0.25)
	Fader.x = 0;

last_pressed = time;
If the elapsed time is less than 0.25 seconds, it will set the fader to zero. If you have a bipolar fader, set it to 0.5.

Example attached.
Attachments
doubleclick.jzml
double click example
(3.6 KiB) Downloaded 202 times
Last edited by brianc on 16 Jun 2012 15:08, edited 1 time in total.
Home Studio 87
Newbie
Posts: 37
Joined: 09 Jun 2012 16:51

Re: reset to default

Post by Home Studio 87 »

thanks I will try
Stephmo
Newbie
Posts: 24
Joined: 22 May 2012 16:09

Re: reset to default

Post by Stephmo »

Phil999 : could you please clarify how to do this step by step ? I'm quite new to this script thing and can't figure it out just following the manual. What I want to do is having a pad that resets my fader at 0db.
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: reset to default

Post by Phil999 »

I'm also quite new to scripting. :)
Did you try the excellent example from brianc? The script should be inside the Pads object that functions as reset button. It tells the Fader object to go to a certain value. Now, to know what value you can use a Monitor object like described above.

I think it should be clear now, but feel free to ask if it isn't. I'm glad being able to help despite my very limited knowledge.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
Stephmo
Newbie
Posts: 24
Joined: 22 May 2012 16:09

Re: reset to default

Post by Stephmo »

Phil999 wrote: but the reset feature should work with a Pads object and a script, executable On Expression x, and the line Knob.x=0.5, assuming the pan knob is bipolar. For the fader Fader.x=? where ? is the value that corresponds 0 dB. You can use a Monitor with Fader.x in the value field object to get that value.
I tried to do this very simple thing but can't get it to work. The monitor thing works but not the pad reset.
There must be something obvious (if that exists in the programming world for someone without a clue) I'm missing. Could you please do this and post it as a module so I can see where my mistake is ? Drives me crazy to be able to patch in Max and not being able to do this :(
nick_liine
Liine Staff
Posts: 285
Joined: 01 Oct 2010 11:06

Re: reset to default

Post by nick_liine »

Stephmo wrote:
Phil999 wrote: but the reset feature should work with a Pads object and a script, executable On Expression x, and the line Knob.x=0.5, assuming the pan knob is bipolar. For the fader Fader.x=? where ? is the value that corresponds 0 dB. You can use a Monitor with Fader.x in the value field object to get that value.
I tried to do this very simple thing but can't get it to work. The monitor thing works but not the pad reset.
There must be something obvious (if that exists in the programming world for someone without a clue) I'm missing. Could you please do this and post it as a module so I can see where my mistake is ? Drives me crazy to be able to patch in Max and not being able to do this :(
example attached, is this what you meant?
resetExample.jzml
(4.53 KiB) Downloaded 275 times
have a look at the user guide and scripting examples in the user library...
Stephmo
Newbie
Posts: 24
Joined: 22 May 2012 16:09

Re: reset to default

Post by Stephmo »

Thanks a lot Nick. I have read the user guide and watched the tutorials but had underestimated the power of the almighty semicolon... :shock: Devil in the detail.
I think I assumed single line scripts didn't need it.
Post Reply