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.
precision
Re: precision
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:
(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!
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;
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
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.
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
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
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
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]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]