Page 1 of 1
reset to default
Posted: 14 Jun 2012 23:35
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
Re: reset to default
Posted: 15 Jun 2012 18:40
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.
Re: reset to default
Posted: 15 Jun 2012 19:54
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.
Re: reset to default
Posted: 16 Jun 2012 07:16
by Home Studio 87
thanks I will try
Re: reset to default
Posted: 28 Jun 2012 14:03
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.
Re: reset to default
Posted: 28 Jun 2012 20:00
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.
Re: reset to default
Posted: 29 Jun 2012 15:17
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
Re: reset to default
Posted: 29 Jun 2012 15:55
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?
have a look at the user guide and scripting examples in the user library...
Re: reset to default
Posted: 30 Jun 2012 20:12
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...
Devil in the detail.
I think I assumed single line scripts didn't need it.