How to make Text object showing numerical values?

Discuss Lemur and share techniques.
hodok
Newbie
Posts: 21
Joined: 15 Jan 2013 14:39

How to make Text object showing numerical values?

Post by hodok »

How to make Text object to show numerical values of variables?
Sorry for maybe obvious question, but I didn't found anything in documentation.
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: How to make Text object showing numerical values?

Post by Softcore »

Is there a reason why you dont want to use "monitor" object? It deals numeric values, and in fact, it displays variables of other objects much easier.
hodok
Newbie
Posts: 21
Joined: 15 Jan 2013 14:39

Re: How to make Text object showing numerical values?

Post by hodok »

There is no reason not to use it, except I wasn't aware of its existence. :)
May I ask what should I do to display on it something like "[variable1] / [variable2]"?
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: How to make Text object showing numerical values?

Post by Softcore »

In the "monitor" object properties look for the "value" input box. In there you put the variable you wish to be displayed - below it you can also put "units" (like dB or %, this is just a visual thing).

Here is an example of 4 monitors all displaying the x of a fader but in different types of "measuring" (raw floating value, percentage, negative-positive percentage, midi values (0-127). Also notice the "precision" functionality - with it you can set how many decimal digits you want displayed (or none if you put precision 0)
Attachments
monitorexamples.jzml
(4.34 KiB) Downloaded 94 times
hodok
Newbie
Posts: 21
Joined: 15 Jan 2013 14:39

Re: How to make Text object showing numerical values?

Post by hodok »

Shame on me, but I still can't make it to display the required variables. What should I do if these variables being inside the script with many other variables?
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: How to make Text object showing numerical values?

Post by Softcore »

Lets stick to Lemur terminology to better understand each other...so.....

Expressions (variables) can exist in Lemur as either
A. Custom expressions inside a project (root level of project) or inside an object. By tapping on the x= button a new expression is created and then you proceed by naming it, and then by defining a static value to it OR handle it with scripts
B. declare an expression in a script

Now, if your variables are of the second nature, i.e. you declare and manage them in a script, then they are "killed" when a script is finshed executing - in other words they cannot be displayed in a monitor, in fact their whole existence is strictly related to the functionality of the script and that only.

At this point you either create custom expressions to replace the expressions used in your scripts OR attach here an example of what you are trying to do so i can help you find a solution!

;)
hodok
Newbie
Posts: 21
Joined: 15 Jan 2013 14:39

Re: How to make Text object showing numerical values?

Post by hodok »

That would be wonderful, if you take a look at this example. See at the the end of the script "cfraction" binded to "Monitor" varables "p3" and "q3".
Attachments
monitor...jzml
(6.03 KiB) Downloaded 71 times
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: How to make Text object showing numerical values?

Post by Softcore »

Here is something to make you understand the logic....Will you understand though why it wont display the correct values once you stop moving the faders?

You need to do what I did with p3 and q3 with ALL the expressions related to the calculation of q3 and p3 or else the calculation exists ONLY while the faders are being moved.
Attachments
monitor.jzml
(6.54 KiB) Downloaded 66 times
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: How to make Text object showing numerical values?

Post by Softcore »

If I didnt do any mistakes transcribing the script, this should be what you are after....BTW I noticed some of the declerations inside the script being completely redundant? For example you declare an expression

qminus1=0

and then a few lines after you have

decl q1 = (a1 * q0) + qminus1;

Why add zero to a multiplication anyways? In fact why is qminus1 even declared? Its not used anywhere else
Perhaps this is part of a greater scheme you didnt send....
Attachments
monitor2.jzml
(10.27 KiB) Downloaded 69 times
hodok
Newbie
Posts: 21
Joined: 15 Jan 2013 14:39

Re: How to make Text object showing numerical values?

Post by hodok »

Thank you! It's pretty much what I needed. So, I have to create expression outside of script, so that it is available to use in other places. Who would have thought? :)
I understood about variables not being available when script is not executed, but it's OK, because I don't need them outside. Actually script represents canonical mathematical formula and I just written it closely to how I would write it on paper, so it is for the sake of human(me) readability, redundant declarations is also for that.
In second example you implemented this algorithm without script body at all. This is indeed useful technique. Although I don't need it in the present case, this made me realize Lemur finds the order of calculations of expressions automatically, which is quite convenient.
Post Reply