OSC Protocol via UDPSend,x,xxx question

Moderator: Moderator Group

OSC Protocol via UDPSend,x,xxx question

Postby chrisr » Fri Apr 21, 2017 8:38 pm

All, hope you are well.

And thanks for any insight on this question. I've read through the forum, and specifically didnt find anything that answered what I was looking for. I am using OSC to control a 3rd party application successfully via the OSC output node. So the straight forward command structure works great. For example : /layer1/clip1/opacity/values , which has a floating value or ,f . I am wondering how does one produce a string that says I'm an OSC transmission. I've tried the obvious UDPSend,1,/layer1/clip1/opacity/values, but where I am obviously failing is this string needs to be defined, as well as the floating value needs to be defined. Understanding that OSC commands are sent in multiples of 32 bits 4, 8 bit bytes. When I try to use UDPSend its not doing the back end work that the node is doing. My question is, if I wanted to format a string command after the UDPSend. What would it look like? Below is a successful string out of TouchOSC:
https://hexler.net/software/touchosc
, this has a floating value you see at the bottom.

Image

So basically just curious if anyone has successfully sent OSC with a UDPSend command. I've read through http://opensoundcontrol.org/spec-1_0 website. Its has provided useful information but I'm still struggling.

Have a great weekend everyone.
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev4242_RC
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev14607
chrisr
 
Posts: 93
Joined: Tue Jan 26, 2016 10:50 pm

Re: OSC Protocol via UDPSend,x,xxx question

Postby schoissi » Tue Apr 25, 2017 5:25 pm

hi Chris,
this is just a guess as i currently can't test it...

i would try to route touch osc into widget designer and read out how the command looks like arriving in WD, via UDP in connection.
probably TouchOSC is converting it automatically as needed, maybe into HEX or something?

i think if you want to send a string, you need to put it into "quotes".
not sure if that is succesfull via udp... (without converting it to HEX or similar...).

best,
Roman

edit:
have a project in summer where i will do somehow the same,
converting enocoder/sensor values to osc...
:-)
schoissi
 
Posts: 51
Joined: Thu Jan 01, 2009 9:48 pm
Location: Seattle, USA

Re: OSC Protocol via UDPSend,x,xxx question

Postby chrisr » Wed Apr 26, 2017 2:26 pm

Roman,
Yes, I have done that. What I believe to be the case for me, is that the packets are arranged in 4 8 byte segments, if you string doesn't add to 4 8 or 32 etc. then you need to add NULL bytes. Which I can not seem to figure out how to do. The null bytes coming in on the TCP IP Test window look like squares. I think this is one of the main issues I'm having is figuring out how to write in NULL bytes in Widget Designer.
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev4242_RC
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev14607
chrisr
 
Posts: 93
Joined: Tue Jan 26, 2016 10:50 pm

Re: OSC Protocol via UDPSend,x,xxx question

Postby schoissi » Thu Apr 27, 2017 6:42 am

did you try adding \x00 ?
for the nulls...

it would be awesome if you could post an example if it works.
schoissi
 
Posts: 51
Joined: Thu Jan 01, 2009 9:48 pm
Location: Seattle, USA

Re: OSC Protocol via UDPSend,x,xxx question

Postby chrisr » Thu Apr 27, 2017 4:08 pm

When I figure it out, I'll post the string.
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev4242_RC
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev14607
chrisr
 
Posts: 93
Joined: Tue Jan 26, 2016 10:50 pm

Re: OSC Protocol via UDPSend,x,xxx question

Postby Dennis Kuypers » Thu Apr 27, 2017 11:01 pm

Hello,

I was thinking about having the ability to send binary data in a very flexible manner. Maybe we could port python's struct.pack syntax to Widget Designer: https://docs.python.org/3.6/library/struct.html
What do you think?

Regards
Dennis
Dennis Kuypers
Product Developer, Software

Online Manual
User avatar
Dennis Kuypers
coolux Germany
 
Posts: 687
Joined: Thu Jul 05, 2012 12:18 pm

Re: OSC Protocol via UDPSend,x,xxx question

Postby schoissi » Fri Apr 28, 2017 6:36 am

sure :D

(following your link, i have currently no clue what this all means...) :D

do you maybe know a basic introduction resource to all of those serial connection things?

i've started playing around with arduino and stuff,
have a midi and dmx shield,
would be great to connect those things with widget designer for future application options...

on another project,
i'm trying to readout nrpn values coming from a bcr2000 with an arduino midi shield,
to control things from another 3rd party application (bmd...)

figuring out osc is on my summer project plan...

i found the hint about \x00 when searching trough the christie spyder remote control specifications (for other stuff...)

thx,
Roman
schoissi
 
Posts: 51
Joined: Thu Jan 01, 2009 9:48 pm
Location: Seattle, USA

Re: OSC Protocol via UDPSend,x,xxx question

Postby Dennis Kuypers » Fri Apr 28, 2017 10:45 am

Hello,

The idea of struct.pack is to build packages of binary data. Well lets start with why we would need this in the first place...

You can represent numbers using different amounts of bytes, like one byte can handle the values from 0-255. If you take the first bit in the byte as the sign, you can do -128 to 127. So values may be signed or unsigned.
Then you can use more than one byte, like, if you use two, you have a "short". So the value of a short is = FIRST_BYTE * 256 + SECOND_BYTE; but wait. Why not FIRST_BYTE + SECOND_BYTE * 256. Either representation is valid, but when talking over the network the systems should agree on one system. Which byte has the greatest impact on the value? If the most significant byte (MSB) comes first, this is called big-endian, the other one is little-endian. In networking it is common to use the network byte order, which is big-endian. Then we have the various sizes with 1, 2, 4, 8 or even more bytes. Those are only the basic number formats. There are also floating point representations and we have other data like text that we might want to send.

Python's struct.pack is a handy tool to define the structure and then convert between the binary format and python's internal formats.

In the following example taken from the Pandoras Box SDK on github you can see the struct.pack in action. The format string tell us that we want "!BlhlB"

Code: Select all
 # + protocol version (byte, currently 1)
        # + domain id (integer)
        # + message size (short)
        # + connection id (int, user definable, defaults to 0)
        # + protocol flag (byte, 0 for TCP)
header = struct.pack("!BlhlB", 1, self.domain, len(data), 0, 0)

https://github.com/PandorasBoxSDK/pbaut ... o.py#L3698

Regards
Dennis
Dennis Kuypers
Product Developer, Software

Online Manual
User avatar
Dennis Kuypers
coolux Germany
 
Posts: 687
Joined: Thu Jul 05, 2012 12:18 pm

Re: OSC Protocol via UDPSend,x,xxx question

Postby chrisr » Tue May 16, 2017 8:28 pm

Dennis, Awesome. And I like Roman, this is above me. Though after reading through your examples and reading the information on the Python site, I do sort of understand where you are going. Also I'm enlisting a friend of mine that will better help me understand. Thanks for the help.

I hate to ask, but Is this doable in WD Ver6? If so this is kind of old news :) Or is 6 much like 4.7 in this matter?

Have a great week Dennis and Roman!!
Thank You

ChrisR
SurfacePro3 - 2GHz i5 - 4GB ram - Windows 10 Pro - WD Pro 4.7 Rev2500 and WD 6 Rev4242_RC
Sager Laptop - Intel 2.4GHz i7 3630QM - 16GB ram - Windows 7 Pro Svc Pack1 - Offline Manager V5.1_Rev13378 & V6_Rev14607
chrisr
 
Posts: 93
Joined: Tue Jan 26, 2016 10:50 pm


Return to Widget Designer V4.7

Who is online

Users browsing this forum: No registered users and 1 guest