On Frame scripts [solved]

Discuss Lemur and share techniques.
Post Reply
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

On Frame scripts [solved]

Post by Phil999 »

I'm pretty proud of this rotating Led that follows the movement of the Knob. Exactly what my forthcoming Diva template needs.

Problem: if the moveLED script is set to execute On Expression x, the Led sits in the top left corner when you load the template. You have to touch the knob so that the Led goes to the right place.

I tried to duplicate the script and set it to execute On Load, but that didn't work. I've also tried delaying another script with the time and the frame variables, which I think would be the best approach, but didn't manage to make it work either. So I finally just set the script to execute On Frame, which works fine. The Led is at the right place when the template is loaded.

Question: I need about a dozen of those Led-equipped Knobs, and therefore as many On-Frame-scripts. Will this reduce the iPad2 performance? Should we avoid On-Frame-scripts, or does it not matter? Can you do a frame counter or timer without On-Frame-scripts? Or are there any other approaches I haven't thought about?
Attachments
trigonometric.jzml
(3.33 KiB) Downloaded 93 times
Last edited by Phil999 on 18 Jan 2013 20:04, edited 1 time in total.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: On Frame scripts

Post by Softcore »

Perhaps consider the "default" x value of the knob when the project is loaded and use it as a constant in an on load script?

For example if you save the project with the knob being at position x=0.5 then on load use the same code to "position" the LED and replace the x variable with 0.5 in the onload script.

Just an idea to avoid the "on frame" scripts.
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: On Frame scripts

Post by Phil999 »

it just doesn't work as I expect with On Load. The value gets set when I load the template, but the action of that value (in a script) for other objects does not happen. But 10 On-Frame scripts are possible, the Led's are always at the right spot.

But now I've got a new problem in my actual template. The Led's vanish when I load the template, and reappear only if I touch the 'LED colour'-Knob. Using the in-app editor I know the Led's are there (not hidden), but invisible (although the 'light' expression is untouched). I've been struggling with that the whole afternoon. :roll: And instead of learning more I get more confused. Doesn't seem logic to me that an Led can be invisible with light=0.

Now I did set the 'setcolour' scripts to On Frame, too. Everything works now, but now I have 20 On-Frame scripts only for those Led's. 10 for the position, 10 for the colour. It works exactly how I want, but it's somehow not satisfying. I must think of those 60 frames per second and 20 permanently executed scripts. Not elegant at all.

I've attached the current Diva template if someone is interested to have a look at those Led's, but it's not immensely important. I first need to understand how to 'initialise' a template properly. I was also thinking about a welcome screen that the user has to click away, and in that button I could put all the necessary commands, avoiding those On-Frame scripts altogether.
Attachments
Diva76.zip
(15.82 KiB) Downloaded 72 times
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: On Frame scripts

Post by Macciza »

Hi

Would need to have a bit more of a look at it all

But noticed you have OnFrame scripts for LED color as well, could probably just execute on change of color var instead . . .

Will check it out a bit more later . . .

MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: On Frame scripts

Post by Phil999 »

yes, 10 for position and 10 for colour. I had those scripts set to change to colour variable (LEDcolour Knob), but as I said I have to touch the Knob first to get the right colours.

I've been working on it yesterday for hours, and so far I have no problems with those On Frame scripts, the template is performing well. Of course I'm very interested in your findings, but it's not very important. I mean, not as important as the NRPN thing that was really necessary. As long as it's functional (and I can say, it is! With only one exception everything is bi-directional, I get the exact equivalent of the plugin GUI on Lemur when I change program) and doesn't crash, I'm happy. Just not so enthusiastic anymore, On Frame scripts seem to me a bit of a cheap solution for this matter, wasting resources unnecessarily.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: On Frame scripts

Post by Macciza »

No worries

Given that they are very basic scripts I don't think the load would be too great
Though I may have to check whether it does execute even if value is unchanged . .
Of course you could add a test for this but then it has to execute that every time . . .

Or make a global 'ledcolor' var set to C_Master.Knob2.c . . .
And execute your setcolor script on this instead of on frame
ledcolor gets set upon load or color change and triggers other scripts
I think the leds are just ending up color =0 (black) ...

To other things . . .
Love the trigLED thing - might repackage it at some point . ..

Re;frame counter - I have used a phasor() script 'phase+=0.01; phase=phase%1; ' and global phase var . . .
This should return a 0-1 ramp incrementing in 0.01 steps in the phase var . . .
I then use this phase for various other things . . .
Hope that makes sense . . .

MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: On Frame scripts

Post by Phil999 »

Macciza wrote: I think the leds are just ending up color =0 (black) ...
this must be the case, I see no other explanation for these 'vanishing' Led's.

Yeah, the load of these On Frame scripts seems not too big. I'll have a look at this matter later, for now I just want to finish and use the Diva template.

Thank you for investigating.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: On Frame scripts

Post by Phil999 »

success! The 'moveLED'-script must be on the container level or higher (project level), then everything loads correctly, with the Leds objects at the right spot. That way one can get rid of all On Frame scripts. It doesn't even need On Load scripts. :)

The same with the colours. One just has to put a variable at the container level, and the colours get set when loading the template.

Again many thanks, Macciza, without you I don't know how long I would have remained in the dark.

I think it would be good to describe the different 'levels' of priority in the next version of the manual. As far as I can tell, it is like this:

1. project level
2. container level
3. object level

Is this correct? I think this should be known to every Lemur user.

And there's something I've been asking myself for a long time: why is there no interface level? Is there a reason for this? It would be very useful to put a couple of variables/scripts, especially for MIDI target/channel at the interface level, so that we could easily add and remove interfaces to a template without losing functionality; it is possible now, but one has to put everything in a very big container (bigger than the interface), and it's neither practical nor easy (weird things can happen).

Feature request: interface level

Or how do you cope with this? I see most templates with stuff in the project level.
Attachments
Diva78led.zip
fixed: TripleVCO Leds objects
(23.02 KiB) Downloaded 70 times
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