OSC Messages

Many people have been using message passing not only to control Max/PD objects, but also to interact with processes living outside MAX/PD such as CSound, SuperCollider, etc.

To make their life easier, Antescofo comes with a builtin OSC server. The OSC protocol can be used to interact with external processes using UDP messages. It can also be used to make two Antescofo objects interact within the same patch. The management of OSC messages is achieved in Antescofo through 4 primitives.

OSCSEND

This keyword introduces the declaration of a named OSC output channel of communication. The declaration takes the form:

          oscsend name host : port msg_prefix

where:

As soon as the OSC channel is declared, it is started and can be used to send messages. Note that sending a message before the definition of the corresponding output channel is interpreted as sending a message to MAX.

Sending an OSC message takes a form similar to sending a message to MAX or PD:

          name arg₁ arg₂ ...

This action construct and send the osc message

          msg_prefix arg₁ arg₂ ...

where msg_prefix is the OSC address declared for name. Note that to handle different message prefixes, different output channels have to be declared.

The character / is accepted in an identifier, so the usual hierarchical name used in OSC message prefixes can be used to identify the output channels. For instance, the declarations:

          oscsend extprocess/start test.ircam.fr : 3245 "start"
          oscsend extprocess/stop  test.ircam.fr : 3245 "stop"

can be used to later invoke

          0.0 extprocess/start "filter1"
          1.5 extprocess/stop "filter1"

OSCRECEIVE

This keyword introduces the declaration of an input channel of communication. The declaration takes the form:

          oscrecv name port msg_prefix $v $v ...

where:

Currently, Antescofo accepts only the following OSC types: bool, int32, int64, float, double, string and the arrays markers bracketing sequence of these values (nested arrays are allowed). These value are converted respectively into boolean, integer, float, string and bracketed sequence are converted into tab.

A Whenever can be used to react to the reception of an OSC message: it is enough to put one of the variables $v as the condition of the whenever.

The reception is active as soon as the input channel is declared.

OSCON and OSCOFF

These two commands take the name of an input channel. Switching off an input channel stops the listening and the message that arrives after, are ignored. Switching on restarts the listening. These commands have no effect on an output channel.

Conversion between OSC types and Antescofo types

Sending (or receiving) an OSC message implies the conversion of an Antescofo value into an OSC value (or the reverse). The conversion is applied following the following mapping

Antescofo value OSC value
bool bool
int int32 see function @set_osc_handling_int64
int int64 see function @set_osc_handling_int64
Float float see function @set_osc_handling_double
Float double see function @set_osc_handling_double
string string
string symbol
tab see function @set_osc_handling_tab

Remarks