Scripting newbie

Discuss Lemur and share techniques.
ErikG
Newbie
Posts: 49
Joined: 06 Oct 2013 10:10

Scripting newbie

Post by ErikG »

Im trying to solve a problem. To do this I suppose I need to understand some basic scripting, but Im unsure of how to get there...
I'll try to explain what I want to do and why in this particular case, perhaps someone will be able to point me in the right direction. It may be a bit hard to understand why if you arent familiar with Nuendo as this specific behavior is to my knowledge unique to Nuendo.

Background explanation if you want to know WHY I want to do this:
In Nuendo there are quite a few limitations to what I can control with bidirectional communications. Some things can only be controlled sending commands to the DAW, but there is no way to get the set status back out again.
So in this particular case I have a few buttons/functions that have three possible states (example: Fill loop, used to record static automation between Left and Right markers, useful when doing automation for a whole scene):
Off
One shot mode: The first "mouse click/command trigger" sets up the loop mode in a one shot fashion, meaning that after automating anything and then pressing stop (or locating in the project some other way) it will revert to its off position.
Locked mode: The next second "mouse click/command trigger" will LOCK the function in a permanent mode, so the function stays active, until it is again changed with a third "mouse click/command trigger" thus turning it all off.

I rarely use the one shot mode, so I'll start by trying to avoid it :-)


So what I want to be able to do is:
On Lemur "button" press 1: send two midi note on commands with a slight delay between them and illuminate Lemur "button" keeping it lit (switch mode style).
On Lemur "button" press 2: send one midi note on command, and change the lit status of the Lemur "button" so it is no longer lit.

So basically I want it to work just like a regular switch, BUT every time it is activated it should send two note on messages, and when it is turned off just one.

Any takers on how to do this?
I will keep digging through the manual and the forums to see if I can figure it out by myself, but I don't mind some assistance :-)

I guess I'll have to create some kind of variable that needs to be updated each time the button is touched. If the counter is set to 0, then change to 1, if it is 1 change to 0. Pretty basic, but I have yet to figure out how to do that.
That will give me a counter that can be referenced wether it should send out a additional midi note on (or not) as the button itself is issuing the basic note on each time anyway.

So I need to figure out how to first script a counter.
Then I need to figure out how to read the counter and use that in a argument that should result in a midi msg being sent out.
Sound post production to feature film & TV.
Nuendo and ProTools. Dubstage with Euphonix S5MC 32 fader.
8 editing rooms without hardware controllers.
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: Scripting newbie

Post by Phil999 »

ErikG wrote: In Nuendo there are quite a few limitations to what I can control with bidirectional communications. Some things can only be controlled sending commands to the DAW, but there is no way to get the set status back out again.
you are using a Generic Remote Device, is that right?
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
ErikG
Newbie
Posts: 49
Joined: 06 Oct 2013 10:10

Re: Scripting newbie

Post by ErikG »

Yes I am, but it only has this as a command thus no bidirectional coms.
Sound post production to feature film & TV.
Nuendo and ProTools. Dubstage with Euphonix S5MC 32 fader.
8 editing rooms without hardware controllers.
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: Scripting newbie

Post by Phil999 »

the Generic Remote Device has MIDI in and out, so it should be possible for Nuendo to send any command back to the controller. In Cubase at least this is the case. It's true that some buttons are different to set up, in certain cases one has to set flags for toggle, push button, not automated. Sometimes one has to use two entries for the same command to achieve the correct behavior.

If you have already tried all options in the Generic Remote Device, and there is no way to get feedback (which I never encountered in Cubase by the way, but it could be some command that is in Nuendo only), then this could be a solution:

if(x==1) noteout[two notes, with delay]
if(x==0) noteout[one note]

and possibly a variable as memory. But first I would check out all options in the Generic Remote Device, to keep it simple.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
ErikG
Newbie
Posts: 49
Joined: 06 Oct 2013 10:10

Re: Scripting newbie

Post by ErikG »

Thanks Phil,
but Yes I'm pretty darn sure, or completely missing something somewhere...
If you have a moment; These two commands in the generic remote should be the same in Cubase that I think you have:
Command:Edit:Deactivate all solo states
Command:Automation:Fill Loop
They can only be set with P flags (Push buttons, and cant be changed) and they do not seem to give any feedback back to Lemur. In fact I think that goes for all commands under the "commands" heading. The commands that generate switching statuses should have feedback back to the controller. Im sure there's more useful stuff that cant do it that I havent found yet.

I'll have to start scripting then. :-)
Sound post production to feature film & TV.
Nuendo and ProTools. Dubstage with Euphonix S5MC 32 fader.
8 editing rooms without hardware controllers.
ErikG
Newbie
Posts: 49
Joined: 06 Oct 2013 10:10

Re: Scripting newbie

Post by ErikG »

Funny this. "Thinking out loud"
Ok so it will be simpler than I thought :-) Not much but...
To send two commands in rapid succession I just need to script two note on messages, no delay or anything. Great.
Now I need to declare a counter and get it to do what I want...

First I need to declare the counter.
On Load
decl counter = 0;

Counter should probably be Expression x based I suppose
On Expression x
IF counter = 0 ++;
ELSE counter --;


I suppose I need a IF/ELSE loop here
On Expression x
IF counter = 1 send two notes;
Return;
ELSE send one note;

Perhaps? Im not at all clear on syntax though.Im sure that IF this may work then it still really won be the good or proper way to do it. It looks clunky to me with multiple scripts. Perhaps it ought to be possible to join the counter and the note sending in one script? Can I run multiple IF in a row? Not sure...
I will have to make it work by finding out how not to do it I guess :-)
Sound post production to feature film & TV.
Nuendo and ProTools. Dubstage with Euphonix S5MC 32 fader.
8 editing rooms without hardware controllers.
ErikG
Newbie
Posts: 49
Joined: 06 Oct 2013 10:10

Re: Scripting newbie

Post by ErikG »

I haven't had time to actually implement what I wrote above yet. Yes I probably spend to much time thinking and to little actually testing...

But now at breakfast I had this eureka moment re-reading my original post.
I should be able to use the color change of the button to define if it should send one or two messages. That would mean no counter, no declaring of variables and a tighter, simpler script.

So yes thinking without actually doing can be pretty useful to.
One day ill get the grey matter in my head to dance and sing the lemur song :)

So instead of using a counter its just a get attribute type of command. Back to the manual on te way to work.

Any comments?
Sound post production to feature film & TV.
Nuendo and ProTools. Dubstage with Euphonix S5MC 32 fader.
8 editing rooms without hardware controllers.
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: Scripting newbie

Post by Phil999 »

just a short info about the 'command' entry in the Generetic Remote: now I understand. You are right about that. They don't give feedback, it's an exception. Sorry, I forgot about that.

But to implement it in your template it looks you're on the right track. I'll have a look at

Command:Edit:Deactivate all solo states
Command:Automation:Fill Loop

soon. Right now I'm in the middle of another Cubase related project.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
ErikG
Newbie
Posts: 49
Joined: 06 Oct 2013 10:10

Re: Scripting newbie

Post by ErikG »

No need to apologise, i just wanted to explain why and for what I need it.
Those two command are just examples, there's a few more that also should have the possibility of bidirectional coms in Cubase/Nuendo.
Sound post production to feature film & TV.
Nuendo and ProTools. Dubstage with Euphonix S5MC 32 fader.
8 editing rooms without hardware controllers.
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: Scripting newbie

Post by Phil999 »

I had a look at 'Command:Edit:Deactivate all solo states'. But I don't know where to begin. What do you actually want Lemur to do? It makes no sense to me. This is a one-shot command that deactivates all soloed channels. You hit it, and it's done. Like the 'Meter reset' command. I don't see the need for feedback or simulated button appearance in Lemur.

If you could explain again please. Do you want a button to light up if a channel is soloed? For this you'd have to monitor every channel and send that info to the button. That would be simple in Lemur, but would need many entries in your GR xml. One for each channel. But I'm not sure if that's what you want.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
Post Reply