[CM] problem with doubles and SC

Rick Taube taube@uiuc.edu
Mon, 12 Dec 2005 16:02:11 -0600


yes using (coerce  pi 'single-float)  works:

? (coerce  pi 'single-float)
3.1415927
? (events (new test :pi (coerce  pi 'single-float)  :time 0) "test.osc" 
:play nil)
"test.osc"
(dumposc "test.osc")
[
[0.0, ["/g_new", 1, 0, 0]],
[0.0, ["/s_new", "test", -1, 0, 1, "pi", 3.1415927]],
[5.0, ["/none"]],
[5.0, ["/none"]]
]
T
?




On Dec 12, 2005, at 12:50 PM, nik gaffney wrote:

> hi,
>
> you might want to check the typetag sent with the message, since 
> doubles are not  'standard' osc datatypes, this might be a problem.
>
> if you dont need 64bits, coerce to a single first. if you do really 
> need 64bit precision in supercollider, then its probably acceptable to 
> output correctly encoded 64bit floats, with the typetag 'd'.
>
> see >> http://www.opensoundcontrol.org/spec-1_0
>
>> There seems to be a problem with OSC and doubles... what follows is a 
>> short example using pi. Notice that when the object is created, it 
>> prints in the listener correctly, but once it is written out to the 
>> .osc file (and then read back with dumposc), the values is definitely 
>> wrong (5.7094773E-9)
>> Any ideas?
>> Thanks,
>> Josh
>> ? (defobject test (scsynth) (pi) (:parameters pi time))
>> ? (new test :pi pi :time 0.0)
>> #i(test time 0.0 node -1 add-action 0 target 1 pi 3.141592653589793D0)
>> ? (events (new test :pi pi :time 0) "test.osc" :play nil)
>> "test.osc"
>> ? (dumposc "test.osc")
>> [
>> [0.0, ["/g_new", 1, 0, 0]],
>> [0.0, ["/s_new", "test", -1, 0, 1, "pi", 5.7094773E-9]],
>> [5.0, ["/none"]],
>> [5.0, ["/none"]]
>> ]
>> T
>> ?
>> ******************************************
>> Joshua Parmenter
>> joshp@u.washington.edu
>> Post-Doctoral Research Associate - Center for Digital Arts and 
>> Experimental Media
>> Raitt Hall - University of Washington
>> Seattle, Washington 98195
>> http://www.dxarts.washington.edu
>> http://homepage.mac.com/joshpar
>> _______________________________________________
>> Cmdist mailing list
>> Cmdist@ccrma.stanford.edu
>> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
>
> _______________________________________________
> Cmdist mailing list
> Cmdist@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist