This thread is only (possibly) relevant if you want to write an app (or (possibly) dig deep into an existing app) to send OSC messages
Following a painful journey to getting a small app to send properly formatted OSC messages to Reaper and a request from Banned to elaborate, I'm distilling the stuff I've learned down here in what should be a jump start to sending OSC messages without reading much (
here's the OSC Protocol here though)
Not receiving messages, I haven't touched that yet but the format is the same.
- OSC Packets (the thing that we send over the network) contain either
-- OSC Messages or
-- OSC Bundles (which can contain messages or other bundles (containing other messages (or other bundles) etc etc)
The only thing we need to know about the OSC Packet is that it needs to be in multiples of 32 bits (4, 8 bit bytes). This explains why we need to pad out parts with NULLs (0 value bytes).
We'll just look at OSC Messages, because that's the only thing I've messed around with.......
- OSC Messages contain 3 elements....
-- OSC Address Patterns: The Command
-- OSC Type Tag String: the type of each (if any) arguments that follow
-- Arguments: the values of the arguments we said we were going to send (if any)
A message starts with a forward slash "/" so that OSC knows what follows is a message and not a bundle. So the command "p" is....
... which needs to be following by a NULL (shown as Z for zero here)...
... and if this isn't a multiple of 4 bytes we need to pad it out make up to 4 bytes (32 bits)...
... tada!! Send that out over to Reaper and it will hear it as an OSC message and not do anything at all with it because it's just a made up command!
If the command "p" needs an argument then we need to say what it/they are going to be. We put the character "," next in the message which tells the receipient of the OSC Message that there is an OSC Type Tag String coming up.
So if we want an integer argument we....
.... and, as with pretty much everything in OSC Messages (apart from float and int argument Values (coming next)), it needs a NULL after it and we need to pad it out to 4 bytes if it comes up short...
.... so the full message so far is....
Next up... numbers.... Grrrr.