[PD] Floats and negative numbers over OSC
Martin Peach
martin.peach at sympatico.ca
Sun Jan 31 18:04:55 CET 2010
PSPunch wrote:
>
> Hi Martin,
>
>
> Thank you for your response.
>
> I am attaching the patch used to produce the following results.
>
> This was tested on
> Pd version 0.41.4-extended,
> running on WinXP SP3.
>
>
> The OSC data were sent by GlovePIE running the following code.
>
> -------
> SendOSC("127.0.0.1", 9997, "/test", 0)
> wait 1 second
> SendOSC("127.0.0.1", 9997, "/test", 1.5)
> wait 1 second
> SendOSC("127.0.0.1", 9997, "/test", -1)
> wait 1 second
> -------
>
>
>
>
> I was expecting [routeOSC] to output 0, 1.5, -1.
>
>
> --- Output ---
>
> raw: 47 116 101 115 116 0 0 0 44 105 0 0 0 0 0 0
> unpacked: /test 0
> routed: 0
>
> raw: 47 116 101 115 116 0 0 0 44 102 0 0 63 63 0 0
> unpacked: /test 0.746094
> routed: 0.746094
>
> raw: 47 116 101 115 116 0 0 0 44 105 0 0 63 63 63 63
> unpacked: /test 1.06111e+009
> routed: 1.06111e+009
>
>
Hmmm, if I try sending the same values from packOSC to routeOSC I get:
routed: 0
unpacked: /test 0
raw: 47 116 101 115 116 0 0 0 44 105 0 0 0 0 0 0
routed: 1.5
unpacked: /test 1.5
raw: 47 116 101 115 116 0 0 0 44 102 0 0 63 192 0 0
routed: -1
unpacked: /test -1
raw: 47 116 101 115 116 0 0 0 44 105 0 0 255 255 255 255
It looks like GlovePIE is sending the wrong numbers. Does it send
anything except 63 for a value? The integer -1 should be 255 255 255
255, or 4294967295 (32 ones), but your device is sending 1061109567, as
though the two most significant bits of each byte are being set to zero.
Martin
More information about the Pd-list
mailing list