LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use UDP to send OSC (Open Sound Control) command?

Bui-

Unclebump is right, you will need to know hwo to format your strings in the OSC format. With the example you listed, the VI should look something like this:

Instead of "Send Your String Here" you would pass "/appled/1/state 1" you will also need to use the correct port and address settings. Running this examples generated teh following packet:

0000  00 00 0c 07 ac 01 00 13  72 1a e8 2d 08 00 45 00   ........ r..-..E.
0010  00 31 bc ce 00 00 80 11  80 a7 0a 00 23 9d c0 a8   .1...... ....#...
0020  0f 01 c3 50 c3 50 00 1d  99 13 53 65 6e 64 20 59   ...P.P.. ..Send Y
0030  6f 75 72 20 53 74 72 69  6e 67 20 48 65 72 65      our Stri ng Here

As you can see the data section (highlighted) is exactly the string that was sent. the biggest problem I see with your packets is that the data length is different (byte 0x0026 and 0x0027). The MAKE packet is returning a length of 0x0020 (32 bytes) and your program is reporting a length  of 0x000E (14). This means that mchelper is sending some additional data instead of just a straight string. If you look more closley at the OSC packet formation, each has three sections; OSC Address Pattern followed by an OSC Type Tag String followed by zero or more OSC Arguments. You have the address pattern correct (/appled/1/state) The Type Tag String, however, is incorrect along with the Argument string. I reccomend taking a closer look at the OSC specification and comparing it to the packet sent by mchelper. You need to incorporate the OSC Type Tag and format your Argument correctly (as a 32 bit integer).


There are examples of the correct data formations here:
http://www.opensoundcontrol.org/specification-examples#OSCstrings


0 Kudos
Message 11 of 20
(4,494 Views)

I noticed that too.

0000  ac de 48 5f ff ff 00 11       25 d3 30 b9 08 00 45 00   ..H_.... %.0...E.
0010  00 34 1e 05 00 00 80 11  9a 37 c0 a8 00 c8 c0 a8   .4...... .7......
0020  00 64 27 10 27 10 00 20  27 28 2f 61 70 70 6c 65   .d'.'..  '(/apple
0030  64 2f 31 2f 73 74 61 74    65 00 2c 69 00 00 00 00   d/1/stat e.,i....
0040  00 01                                              ..              

when I typed /appled/1/state, it gives everything before the bold secion.

I dont know what to do with all those extra bits, I have tried using ,f and ,iisff after state, but it doesnt work.

0 Kudos
Message 12 of 20
(4,486 Views)
Bui-

You are missing a couple of things. First, you are not inserting the NULL characters between arguments correctly. Second, you are not sending your integer as the correct width. Remember, it wants a 32 bit integer, not just an 8 bit number.
0 Kudos
Message 13 of 20
(4,477 Views)
Hi
I am a little confused.
How about the "1" before state?
And how do I make to 32 bit integer?
0 Kudos
Message 14 of 20
(4,468 Views)
Bui-

You need to build the string according to the protocol (have you read it yet?). Here is a quick example showing how to concatinate the three parts of the OSC packet (Address String, Type Tag, and Argument).



Notice that I insert a 00 (refered to as a null character in the OSC protocol) in between each part of the packet. Also, use the Number to Hexidecimal String VI to force a number into a HEX string of a particular length.
0 Kudos
Message 15 of 20
(4,450 Views)
Hi,
Thanks for your help, I have some ideas of doing it now.
However, there is problem when sending longer numbers such as 1023.
Labview will send 31 30 32 33 instead of 03 FF.
 
And it will send 30 when it changes number 0 to hex string 0.  It is right, but I want 00.
 
Is there a good way to modify it?

Message Edited by bui on 11-27-2006 03:11 PM

0 Kudos
Message 16 of 20
(4,399 Views)
Hello Bui-

You are seeing this behavior because labview is using one byte for each character (that's the purpose of sending it as a string). 31 = 1, 30 = 0, 32 = 2, 33 = 3.

This should be the same way that the make program is sending the data.

Xaq
0 Kudos
Message 17 of 20
(4,382 Views)
Hi
 
Tha controller sends information like (1023 -> 03 FF), which is different from labview.
0 Kudos
Message 18 of 20
(4,379 Views)
Highlighted
Hey Bui-

Try using the Number to Hexidecimal String Vi instead of the number to decimal string. That should produce the correct output.
0 Kudos
Message 19 of 20
(4,357 Views)

Hi,

I was using Number to Hex string.

0 Kudos
Message 20 of 20
(4,347 Views)