General

reset to default

Started by Home Studio 87 on .

Sign in or create an account to join the conversation.

9 posts

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.
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:
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.

doubleclick.jzml
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.
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.
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 :(
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

have a look at the user guide and scripting examples in the user library...
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.