Hi, new here. Building my first project at the moment.

Welcome to the MIDI Kinetics forum. New users are required to post here in order to have access to the rest of the board.
Post Reply
slingdinger
Newbie
Posts: 3
Joined: 18 Mar 2015 20:25

Hi, new here. Building my first project at the moment.

Post by slingdinger »

Been learning how to use Lemur for a couple of days now. My first project is a controller for the Pigtronix Inifinity Looper midi input. Working well so far, but I could definitely use some help with scripting.

I've added a pad button to a fader acting as a momentary on/off switch. Right now I have two scripts running in that pad, one where x=0 executeas leaving zero, and one where x=0.5 executes reaching zero. That works well as a momentary on/off switch, but it always returns to a fixed value. Can I set it so the fader returns to the original value set before I've engaged the pad?
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: Hi, new here. Building my first project at the moment.

Post by Phil999 »

yes, you can do this with an expression to save the last 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
slingdinger
Newbie
Posts: 3
Joined: 18 Mar 2015 20:25

Re: Hi, new here. Building my first project at the moment.

Post by slingdinger »

Great! How would that look? I'm still getting the hang of how expressions and scripts work together.
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Hi, new here. Building my first project at the moment.

Post by Softcore »

Check out the scripts in both Pad and Fader object! ;)
Attachments
checkThisOut.jzml
(5.08 KiB) Downloaded 58 times
slingdinger
Newbie
Posts: 3
Joined: 18 Mar 2015 20:25

Re: Hi, new here. Building my first project at the moment.

Post by slingdinger »

Thank you, that's exactly what I needed! Makes sense now.
group
Newbie
Posts: 2
Joined: 18 Apr 2015 10:16

Re: Hi, new here. Building my first project at the moment.

Post by group »

I'm still getting the hang of how expressions and scripts work together.???
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Hi, new here. Building my first project at the moment.

Post by Softcore »

Expressions are just "variables" you "create" and name as you want (either inside objects or globally).

The whole thing then, with scripts is that you make them "execute" when something happens to an expresion - for example to make a script execute when a button is pressed, you create a script : on Expression, x, any

Then inside the scripts you are free to do what you want with your own expressions in a logic - mathematical form so that you can get the result you are after. Thats the philosophy in a nutshell - so to answer your question, scripts work together with expressions in the ways YOU want - how you instruct them to do so, inside the scripts.

;)
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Hi, new here. Building my first project at the moment.

Post by Softcore »

Lets look at the example above.

Inside the "pad" object we create an expression we call "last". We leave it blank, that is we dont give it any discreet value (we could if we wanted).

Then we have used a script which we named "setlast" because thats what we plan to do with it - "store" the last value of our fader in the expression "last".

Lets analyze this bit though - what do we mean, when we say "save the last fader value".
The LAST fader value is whatever value the fader has, WHEN WE LET IT GO (untouch).

A haaaaa, bright moment: the z variable of objects goes 1 when we touch them, 0 when we let them go.

So....... if we can have way to "store" the fader's value WHEN we let it go....then THAT value is the "last" value we want the fader to return to, when we let go of that "pad".
Easy then, the script we created "setlast" needs to be "executed" when we let go of the fader, that is
on expression z, falling to zero (down arrow)

Code: Select all

last=x;
Having done that, we then go to our pad.
Now all we have to do, is instruct the pad to get the fader to 0 when we press it, then make the fader return to the last value when we let it go.

Thus we end up with the script setfader which resides inside the pad button - remember the x of a Pad object is 1 when the pad is pressed, 0 when the pad is released.
on expression x, any

Code: Select all

if (x)  Fader.x=0;
means: if Pad.x is anything but 0 (if the Pad is pressed), get the fader down to zero

Code: Select all

else Fader.x=Fader.last;
means: else (if Pad.x is zero, if Pad is released) go get the value stored inside Fader object named "last" and make the fader go to THAT value. But that value was set the LAST time we let go of the fader, due to our first script, "setlast".
sosad
Newbie
Posts: 1
Joined: 27 Apr 2015 12:02

Re: Hi, new here. Building my first project at the moment.

Post by sosad »

Inside the "pad" object we create an expression we call "last". We leave it blank, that is we dont give it any discreet value (we could if we wanted).

Then we have used a script which we named "setlast" because thats what we plan to do with it - "store" the last value of our fader in the expression "last".

Lets analyze this bit though - what do we mean, when we say "save the last fader value".
The LAST fader value is whatever value the fader has, WHEN WE LET IT GO (untouch).
Post Reply