Just getting into lemur scripting.. battery indicator? etc

Discuss Lemur and share techniques.
Post Reply
tsutek
Newbie
Posts: 7
Joined: 07 Dec 2013 17:43

Just getting into lemur scripting.. battery indicator? etc

Post by tsutek »

Hi,

just got into lemur and lemur scripting. I have (at least) two questions:

1) Is there a good resource somewhere for learning lemur scripting? Youtube tuts don't seem to offer much, at least with a casual search. I have read on here that people are supposed to learn to script by disassembling stuff from the user library, but I don't really think that's the best way to learn.. Quite convoluted and takes a lot of effort in finding the right puzzle pieces etc. No-one has made a book about lemur scripting? Or a blog? Any learning resources, free or not, would be greatly appreciated!

2) A more specific question: I am making a "low battery warning" indicator to my first lemur template, which currently uses "frame" triggering for evaluating the battery level. IIRC, that makes 60 battery level checks per second, horribly redundant! What could be a more appropriate trigger for my battery level checking script?

IMVHO lemur would be a lot more popular if the scripting capabilities were more known to the public. Poor scripting documentation/tutorials gives a signal comparable to an open source project, a development nightmare for anyone coming from outside the system.. ;) I bet most ppl just get discouraged and use existing templates (?) I am not saying this to diss, just stating facts, nothing personal towards anyone..

Cheers
iPad Air / iOS 7.0.4 / OSX 10.7
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Just getting into lemur scripting.. battery indicator? e

Post by Macciza »

Hi

1. Start with the Lemur manual, print it out somehow and go through the examples; check out the tutorials in the Library and also the various modules available; play around and make stuff even if it doesn't quite work or do what you want . . . Learn . . .
It will help if you learn a bit of basic C style programming concepts to be able to understand and write scripts if you want to get into some of the more complex capabilities, or pull apart others projects . . .
But remember also that programming/scripting is not a necessity for achieving things in Lemur, a great deal of functionality can be programmed through the IDE/Editor.
Programming is really just recipes/instructions for what, when and how to do things, and the logic behind it all; once you've learnt a bit of any language it can be transferred to other systems.
The core concepts of data, variables, functions, all remain much the same but the grammar, command names, scope and syntax rules etc may all change

2. This where a little bit of programming knowledge and thought can come in handy, though the concept is probably covered in the manual any way . . .
The way Lemur provides battery data is via a built-in 'variable' not a function (function have () after their name, and often arguments as well) . . . Aaah I here you say . . ..
What that means is that you don't really need to do anything apart from use it. If you put 'battery' in a Monitor it will return its value in a 0-1 range . . .
Do what you want with it now, multiply it by 100 to get a 0-100 range, use it as the value for other objects, use it in scripts etc . . .

Basically much can be achieved using just the Editor to set things up, and if you know something about how to program you will take to Lemur scripting fairly easily . . .
That said I do hope to be doing a bit more stuff along the lines of some of the tutorial stuff you mentioned at some point . .
Cheers
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]
tsutek
Newbie
Posts: 7
Joined: 07 Dec 2013 17:43

Re: Just getting into lemur scripting.. battery indicator? e

Post by tsutek »

Hi Macciza,

Thanks for chiming in. I do actually know a bit of programming, especially object oriented programming, so I am familiar with most of the concepts. And I do know that it is impossible to teach programming in a really detailed, highly contextual way that would still apply to wide range of cases. But there are tons of really excellently written books on learning many types of programming, which increase one's learning speed a thousandfold, which is why I'd be very eager to get my hands on one. But I guess one hasn't been authored yet..

And I do know that it's a built-in variable, getting the value is easy enough. But in this particular case I am strictly interested in the following logic:

1. evaluate battery amount at certain intervals (something like once every 10 000 ms)
1.1. if battery level upon evaluation cycle < 0.10 , set containertab to "1"
1.2. if battery level upon eval cycle > 0.10, set containertab to "0"

So any tips on how to script this in the least resource-consuming way would be appreciated.

Cheers
iPad Air / iOS 7.0.4 / OSX 10.7
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: Just getting into lemur scripting.. battery indicator? e

Post by Phil999 »

it's in the manual - I also recommend to start there. It's the fastest way. Just recently I needed a battery indicator, opened the manual, found the needed code, applied it to the template, done. A question of minutes.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
tsutek
Newbie
Posts: 7
Joined: 07 Dec 2013 17:43

Re: Just getting into lemur scripting.. battery indicator? e

Post by tsutek »

hmm.. so it only takes a script execution like:
execution -> on expression -> battery<0.1 ?

Couldn't you have just said so... You guys are so helpful ;) I know it's all about RTFM etc and not catering to the instant-gratification-tldr-generation, but.. Ahh nevermind, having a bad day I guess.

Cheers

EDIT - that's not the way it works either it seems.. Bring on the frustration! Grr
Last edited by tsutek on 12 Dec 2013 14:26, edited 1 time in total.
iPad Air / iOS 7.0.4 / OSX 10.7
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Just getting into lemur scripting.. battery indicator? e

Post by Macciza »

Sorry
Meant to get back on this one, tried to answer the generalist question bit first - my answers will vary depending on my mood and day etc . . .

Yeah that would probably work, it's often difficult answering stuff with no idea of other context info, things can be done lots of ways . .

You can even get OO'ish with Lemur via modules (think of it as a way of subclassing) add variable and functions as needed and reuse them . ..
Or encapsulate stuff in Containers to present themselves as a single object at the higher scope . .

Anyway glad you got it sorted . ..

Scripting tip - Use a Monitor object (and maybe a Fader for input) to debug stuff -syntax, logic, inspect variables or results etc . . .

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]
tsutek
Newbie
Posts: 7
Joined: 07 Dec 2013 17:43

Re: Just getting into lemur scripting.. battery indicator? e

Post by tsutek »

Thanks for the tip man! I'll make a habit of testing script logic via faders and monitors first.

Cheers
iPad Air / iOS 7.0.4 / OSX 10.7
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Just getting into lemur scripting.. battery indicator? e

Post by Macciza »

Comes in handy sometimes . . .
Oh and some of the vector/array stuff might be different to what you have used in other languages
Truncation on maths ops, or what a function actually returns
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]
tsutek
Newbie
Posts: 7
Joined: 07 Dec 2013 17:43

Re: Just getting into lemur scripting.. battery indicator? e

Post by tsutek »

No worries, I'll check float truncation logic via monitors and use the supplied rounding functions when necessary..

Seems like doing script-based stuff is not terribly well supported in the in-app-editor of lemur? Seems like there's a bunch of parameters I cannot access at all from the IAE.. O'well, will continue sorting this out at home..
iPad Air / iOS 7.0.4 / OSX 10.7
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Just getting into lemur scripting.. battery indicator? e

Post by Macciza »

Yeah, thats right
Serious project development is really best done in the Editor
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]
Post Reply