Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
OSC-pipe/render.cpp

Open Sound Control

This example shows an implementation of OSC (Open Sound Control) which was developed at UC Berkeley Center for New Music and Audio Technology (CNMAT). It is very similar to Communication/OSC, but it uses a rt-safe pipe to exchange data between the thread that receives the incoming OSC messages and the audio thread.

It is designed to run alongside resources/osc/osc.js. For the example to work, run in a terminal on the board ``` node /root/Bela/resources/osc/osc.js ```

In setup() an OSC message is sent to address /osc-setup, it then waits 1 second for a reply on /osc-setup-reply.

In render() the code receives OSC messages, parses them, and sends back an acknowledgment.

Incoming OSC messages reach the program through the on_receive() callback. In here, their content is written to a pipe. The pipe is read at the other end from within render(). Once render() is done with the data, the data is sent back through the pipe so that it can be deleted in a real-time safe way.

Unfortunately, the process of creating a OSC message within render() is not itself real-time safe, but it seems to only cause a problem the first time render() is run, so it is acceptable.