Learn creative coding writing simple programs

138. Processing talks to SuperCollider via OSC

We have previously taken a brief look at OSC (in episodes 102 and 105). OSC is something that lets different programs running in the same or in different computers communicate.

By using OSC we can send messages between Processing and SuperCollider. In this episode we make an old Processing program send messages to SuperCollider, so it can now produce sound.

In the Processing side we need a library called oscP5. If you don't have it installed, go to the Sketch menu, import Library, add Library, and search and install oscP5.

In the program I write I map the vertical position of the star to numbers between 0 and 1. If I would not do that, imagine I make SuperCollider produce nice sounds for my stars, and then I go and increase the height of my Processing sketch (changing size()). Suddenly, the numbers SuperCollider would receive could be larger, and maybe it would sound bad. If I map the vertical position to numbers between 0 and 1, the numbers received by SuperCollider will stay in the same range no matter what size() I use: always 0 to 1. When receiving values via OSC is good to have predictable ranges.

I will be doing more videos without introducing new concepts so you become more comfortable with the SuperCollider topics I introduced so far.

Tags: supercollider, osc, oscdef, oscp5, sound

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus