OSC and MAX 7

For this post Im going to explain the OSC (Open Sound Control) protocol and its importance in music technology, while creating a very simple Max patch to work with processing to demonstrate it and as always there will be a free download. Processing is software/language based on java used to create art , its free and available here.

OSC is a communication protocol that allows musical instruments , computers and other multimedia devices to share music performance data in real time over a network (wiki).
Using unique URL style names , music technology devices can communicate with each other, an example of this would be Touch OSC and Lemur which are apps used to create your own MIDI/OSC controller to use with Ableton , Resolume and other audio and video software to trigger clips and control the many aspect within the software.  A screenshot of TouchOSC can be seen below, a full live controller for a DAW is created on an iPad, another example of TouchOSC would be a mixer being created which allows the sound engineer to walk around in a live venue and adjust the levels and ensure that each microphone is working using an iPad which sends OSC messages to a digital mixing desk.

Touch OSC

The OSC protocol can also be used in allowing external devices to work within Max , for example a Wii remote. With the virtual orchestra I created in Max , a Wii remote was used to control the different aspects of the music sections (similar to a conductors baton) . This was achieved using OSC , each gesture was given a unique address for example
“route /wii/1/button/B” in the case of this address , once the B button on the Wii remote was pressed , Max would receive a bang and an audio clip would play, this was also done with other gestures for example moving the Wii remote vertically.


Using a modified version of a processing patch created by Daniel Shiffman , we will create a Max patch which will trigger a sample every time the ball bounces within the processing patch. So the ball will bounce in the programming software , send an OSC message to Max where Max will trigger a bang to trigger a sample (or anything that you want).
First in the Processing patch we will set your IP address and the port number to 6669 this is done by typing :
myRemoteLocation = new NetAddress(“″,6669);” 
An If Statement is written which basically says if the ball bounces send OSC , this is displayed by :
“if ((location.x > width) || (location.x < 0)) { velocity.x = velocity.x *-1; sendOSC();”
Finally we add an OSC message by typing :
“OscMessage myMessage = newOscMessage(“/bounce”);”

You dont need to worry too much about the code , just take notice of the Port Number and the unique URL message (/bounce). Next step is to create the Max patch.
The first step will be to get a way to receive the OSC message which is being transmitted from our Processing patch. udpreceive  and route objects are used to achieve this.
Remember when we set the port number to 6669 in Processing , the udpreceive object is where we set the port number and IP address in Max , in this case just the port number will do. This object is connected to the route object which contains our unique URL style message (/bounce).


Now that we have an OSC message coming into Max, we can do something with it.
The sel object is used next , this allows you to assign any character on a keyboard and when pressed will send a bang, we use the number 1 here which is attached to a bang and then a message with the number 1.
Once this is done we select any sample from the Max audio library, this can be gotten by pressing the musical note symbol , then you can simply drag in any audio file you wish , but for the purpose of this exercise we will use a short sample as the ball will be bouncing regularly. We use the ezdac~ object to allow for audio output.

Inserting an Audio File

To test it press play button on the Processing patch and then lock the Max patch (cmd+E) and then turn on the audio. You should see the bang object flashing every time the ball bounces which results in the sample playing, I have included screenshots of how it should look below and both files can be downloaded here.  What we created here is similar to principle of Syphon which is used by Vj’s. Video is sent from one piece of software to another , for example video from VDMX could be sent to Mad Mapper to allow for the manipulation and mapping of video onto objects.
As you can see OSC has many uses and is relatively easy to implement .
Thank you for reading and feel free to leave a comment and follow , the next post will be a download of an Audio-Visual patch for Ableton Live. If you want to read more on OSC check out the link below.


Screen Shot 2017-02-21 at 22.55.59.png
Max and Processing Patches

2 thoughts on “OSC and MAX 7

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s