OSC In CHOP
The OSC In CHOP is used to accept Open Sound Control Messages. OSC In can be used to accept messages from either a 3rd party application which adheres to the Open Sound Control specification (http://www.cnmat.berkeley.edu/OpenSoundControl/). OSC In is based on a connection-less system, meaning that it can accept multiple messages for any number of sources at the same time. The user must specify a port number which OSC In will look for incoming messages. This port must not have anything running on it before OSC In attempts to use it. OSC CHOPs in TouchDesigner use the udp transport protocol.
There are options which allow the user to adjust the default message queuing system to optimize it for their specific network conditions and usage needs. The Min/Max Target size specifies a range which the queue attempts to keep the buffer size at in seconds. Increasing the Queue Adjust Time will determine how long the queue can be outside that range before it tries to correct it.
If the user wishes to use OSC In to detect when messages are arriving, there is a Pulse Mode toggle which will read a single sample of any incoming message when it arrives and displays the pulse reset values any other time. This is useful for syncing beats between TouchDesigner and another applications.
TouchDesigner's OSC In accepts bundled data based on the Open Sound Control specifications. Channel names are taken from the OSC-Method names given in the bundle. Currently OSC In only accepts floats, integers and 64 bit OSC-Time tags. TouchDesigner will flag a warning if any other data type arrives. If more than one piece of data is sent in an OSC-Method, they will be separated into two channels with a underscore followed by a number concatenated at the end, depending on the order they are defined in the OSC Message. Any OSC-Method names specified with spaces are automatically converted to underscores (_) on receipt in order to make valid channel names.
TouchDesigner either uses the time stamps provided in the OSC Bundle or Message. If a timestamp is provided in an OSC Message along side data, the time stamp must come before the data in the message. If a time stamp is not provided then TouchDesigner will stamp the message using the system time of when the message was received.
The OSC In CHOP will output something meaningful on any number of numeric arguments of any type (midi, rgb, etc). For example an OSC message of: /color (rgb-value) will now create channels:
color1 color2 color3.
To analyze the timing of the messages coming in, attach an Info CHOP to the OSC In CHOP. It will show the internal queue size and whether it is dropping or missing data (
queue_retarded_total should not be increasing, and
queue_length should not be zero).
Parameters - OSC In Page
/protocol - The network protocol to use. Refer to the Network Protocols article for more information.
/netaddress - When using Multicast, this is the address that OSC In will listen for packets on.
/port - The port which OSC-In will accept packets on.
/active - While on, the CHOP receives information sent to the network port. While Off, no updating occurs. Data sent to the port is lost.
/address - To reduce which channels are generated, you can use channel name patterns to include or exclude channels. For example,
^*accel* will exclude accelerometer channels coming in from an Apple iPod Touch or iPhone app like mrmr. See Pattern Matching for the syntax of the possible channel name patterns.
Use Global Rate
/useglobalrate - When on, the CHOP will sample at the global sample rate specified by TouchDesigner.
Default Sample Rate
/samplerate - When Use Global Rate is off, this parameter is used to determine the sample rate of this CHOP.
/mintarget - The smallest amount of queue data (represented in seconds) allowed without adjusting sampling speed.
/maxtarget - The largest amount of queue data (represented in seconds) allowed without adjusting sampling speed.
/maxqueue - The maximum allowed size of the queue (represented in seconds). If the maximum queue size is exceeded, data will be removed from the front of the queue.
Queue Adjust Time
/adjusttime - The maximum amount of time allowed for a queue to be above or below the maximum or minimum target without adjusting the sampling speed.
Delete Old Channels
/deleteold - delete channels that are old.
/reset - Deletes all known channels and clears the queue.
Note: all data is sent in big endian format.
||(OSC-Taglist, lists the types of data associated with this message)|
||(The value of the first piece of data)|
||(The value of the second piece of data)|
Description: This is a message which will create two channels named channame which contains the values. A float (
0.234) and an integer (
1234). Because there are two values for a single channel,
_0 will be added to the end of the channel name containing the float (
_1 will be added to the end of the channel containing the integer (
||(64-bit tag specifying this packet as a bundle)|
||(64-bit time stamp associated with this bundle)|
||(32-bit integer, number of bytes containing the first method)\|
||(OSC-Taglist, lists a single float as the types of data associated with this message)|
(32-bit float, the value of the data)
||(32-bit integer, Number of bytes contained the second method)|
||(OSC-Taglist, lists a float and an OSC-Timetag as the data for this message)|
||(64-bit float, the value of the time tag)|
||(32-bit float, the value of the float)|
Here's a Max patch for sending ints or floats to TouchDesigner. It works with a default OSC In CHOP.
#N vpatcher 425 78 1251 719;
#P window setfont "Sans Serif" 9.;
#P flonum 276 71 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 277 160 60 9109513 prepend /foo;
#P number 226 74 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 232 340 114 9109513 udp-write 127.0.0.1 10000;
#P newex 232 257 115 9109513 OpenSoundControl 2000;
#P button 198 146 36 0;
#P connect 5 0 0 0;
#P connect 3 0 0 0;
#P connect 0 0 1 0;
#P connect 4 0 1 0;
#P connect 1 0 2 0;
#P connect 5 0 4 0;
#P connect 3 0 4 0;
Note: all messages are word aligned (4 bytes).
For more help understanding how to construct OSC messages, please consult the OSC Home page.
Standard Options and Local Variables