Page 1 of 1
precision
Posted: 14 Dec 2012 12:34
by nitefish
Bonjour,
I'm trying to create a template for a SuperCollider synth and I've got a 'value' problem:
I've set the precision of one of my variables to 3 with the Lemur editor,and if I monitor this value in SuperCollider,I have a precision of 13
(I just need '0.130' and I've got'0.1305643286953'...)
With the Lemur,is there a way to set the precision of the value wich is running over OSC?
In advance thank you.
Re: precision
Posted: 14 Dec 2012 14:26
by Softcore
The precision setting changes only the appearance of a value inside Lemur (in a label, or a monitor display). There are rounding functions bulit-in in Lemur but they all round to integers so these wont do either, you need to create a script for the rounding you need.
Off the top of my head:
create a new "out" variable
Then create a script:
Code: Select all
on Expression x
decl i;
i=1000*x;
out=(floor(i))/1000;
(obviously you need to map the "out" variable to your OSC target, instead of x)
Essentially what we do is multiply the x value with 1000 (for example for x=0.125463872 we get i=125.463872) then we take the floor integer (i=125) and we divide it again by 1000 to finally get out=0.125
Note: perhaps there's a better/faster/smarter way - Im not very experienced at this stuff but I believe it will work!
Re: precision
Posted: 14 Dec 2012 18:23
by nitefish
Thanks for your reply.
I am not able to make your script to run but ,following your demonstration,I have set a variable:
out =(floor(x*1000))*0.001,but now I get values like this:
0.36000001430511
0.358000010252
I just got all those zeros at the same place on each value,but no precision of 3...
The 'floor' thing alone send the expected value and precision in SuperCollider,for info.
Re: precision
Posted: 14 Dec 2012 22:35
by Macciza
Hi
Really need a bit more info -example code, script , project etc
What are you doing with it in SC, can't you just truncate/precision it there ?
MM