The format of SuperCollider OSC messages.

This information is useful for people (or members of alien races) who want to exchange OSC
messages between SuperCollider and other software.
If you only want to use OSC between copies of SuperCollider then you don't need to know this.

SuperCollider follows the Open Sound Control specification as defined by CNMAT.
See:    http://www.cnmat.berkeley.edu/OSC
SuperCollider always formats its messages in a particular way and adds a couple of argument types
to those given in the spec.

SuperCollider sends an ASCII string of tags as the first argument after the address in an OSC message.
Following the list of tags is the binary data that conform to those tags for the arguments of the message.
All messages sent to SuperCollider must have a tag string. SuperCollider can send untagged messages
via the sendNoTags method. However the topic of this file is the structure of tagged messages.

The new binary argument types are limited to32 bit char and 32 bit RGBA color, both of
which are safely interpretable as 32 bit integers by programs that do not support them.
The other types that appear such as true, false, nil, inf and Arrays are only features of the
tags string and can be ignored if the program desires (in the case of Array, perhaps),
or converted to something that makes sense (for example MAX converting true, false,
nil, and inf to symbols).

Here is the list of tags used by SuperCollider:

i = 32 bit integer.
h = 64 bit integer. Read but never written by SuperCollider.
 SuperCollider does not have 64 bit integers as a native type,
 so this gets converted to a double float when received.
t = same as 'h'.
f = 32 bit float.
 SuperCollider's native floating point format is a 64 bit double,
 so this is converted to a double when received.
d = 64 bit double float. The native floating point format for SuperCollider.
s = a multiple-of-4-byte-padded ascii string which represents a Symbol object.
S = a multiple-of-4-byte-padded ascii string which represents a String object.
c = an ascii character, sent as 32 bits.
r = a 32 bit RGBA color.
m = reserved for 4 byte MIDI message. not currently implemented.
 bytes from MSB to LSB are: port id, status byte, data1, data2
T = true. No bytes are allocated in the argument data.
F = false. No bytes are allocated in the argument data.
N = nil. No bytes are allocated in the argument data.
I = inf. No bytes are allocated in the argument data.
[ = indicates the beginning of an Array. The tags following are for data
 in the Array until a close brace tag is reached.
] = indicates the end of an Array.


So for example the following call:

port.send("#bundle", 0, [
 ["/sc/post", 1, 2.3, 'abc', ["def", $g, rgb(128,32,64)], true, false, nil, inf],
 ["/sc/post", 0, [1, 2, [3, 4], 5], 6]
]);

Generates the following packet data:

HEX   HUMAN READABLE WHAT IT IS SIZE

23 62 75 6E
64 6C 65 00 "#bundle"   address  8 bytes
00 00 00 00
00 00 00 00 0    timestamp  8 bytes
00 00 00 38 56    message size 4 bytes
2F 73 63 2F
70 6F 73 74
00 00 00 00 "/sc/post"  address  12 bytes
69 64 73 5B
74 63 69 5D
54 46 4E 49
00 00 00 00 "ids[Scr]TFNI" tags   16 bytes
00 00 00 01  1    integer  4 bytes
40 02 66 66
66 66 66 66 2.3    double  8 bytes
61 62 63 00  "abc"   symbol  4 bytes
64 65 66 00  "def"   string  4 bytes
00 00 00 67  'g'    char   4 bytes
80 20 40 FF  rgb(128,32,64) RGBA   4 bytes
00 00 00 34  52    message size 4 bytes
2F 73 63 2F  
70 6F 73 74
00 00 00 00  "/sc/post"  address  12 bytes
69 5B 69 69
5B 69 69 5D
69 5D 69 00  "i[ii[ii]i]i"  tags   12 bytes
00 00 00 00  0    integer  4 bytes
00 00 00 01  1    integer  4 bytes
00 00 00 02  2    integer  4 bytes
00 00 00 03  3    integer  4 bytes
00 00 00 04  4    integer  4 bytes
00 00 00 05  5    integer  4 bytes
00 00 00 06 6    integer  4 bytes



This page was created by SimpleText2Html 1.0.3 on 26-Jul-100.