BITalino R-IoT
User Manual
BR 20200207
28 of 42
7
The OSC structure
For a better understanding of the next sections of this manual, it is necessary to dedicate
a few lines to the structure of the OSC messages.
7.1
OSC Syntax
Open Sound Control (OSC) is an open, transport-independent, message-based protocol
developed for communication among computers, sound synthesizers, and other
multimedia devices
The syntax of OSC data its structured as follows:
7.1.1
Atomic Data Types
All OSC data is composed of the following fundamental data types:
•
int32:
A 32-bit big-endian two's complement integer.
•
OSC-timetag:
A 64-bit big-endian fixed-point time tag, semantics defined below
•
float32:
A 32-bit big-endian IEEE 754 floating point number.
•
OSC-string:
A sequence of non-null ASCII characters followed by a null, followed
by 0-3 additional null characters to make the total number of bits a multiple of
32. (OSC-string examples) In this document, example OSC-strings will be written
without the null characters, surrounded by double quotes.
•
OSC-blob:
An int32 size count, followed by that many 8-bit bytes of arbitrary
binary data, followed by 0-3 additional zero bytes to make the total number of bits
a multiple of 32.
The size of every atomic data type in OSC is a multiple of 32 bits. This guarantees
that if the beginning of a block of OSC data is 32-bit aligned, every number in the
OSC data will be 32-bit aligned.
7.1.2
OSC Packets
The unit of transmission of OSC is an OSC Packet. Any application that sends OSC Packets
is an
OSC Client
; any application that receives OSC Packets is an
OSC Server
.
An OSC packet consists of its contents, a contiguous block of binary data, and its size, the
number of 8-bit bytes that comprise the contents. The size of an OSC packet is always a
multiple of 4.
The underlying network that delivers an OSC packet is responsible for delivering both the
contents and the size to the OSC application. An OSC packet can be naturally represented
by a datagram by a network protocol such as UDP. In a stream-based protocol such as
TCP, the stream should begin with an int32 giving the size of the first packet, followed
by the contents of the first packet, followed by the size of the second packet, etc.
The contents of an OSC packet must be either an
OSC Message
or an
OSC Bundle
. The first
byte of the packet's contents unambiguously distinguishes between these two
alternatives.