Raspberry Pi and OSC: Part 1

Alright so you have a Raspberry Pi that you would like to incorporate into a media project some how. There are many ways of getting data to and from it, but one of the easiest ways is with Open Sound Control (OSC). If you are not familiar with the basics of OSC you should check out this website. This tutorial will run you through the basics of installing OSC onto your raspberry pi and using it in python.

NOTE: It is completely possible to install and run all of this in GUI, however I will be doing all of it in command line.

Here we go:

We will be using this library called pyOSC.

Assuming you are logged or SSHed into your Pi, the first thing we will need to do is clone the GIT repository onto our device. In the shell type:

git clone https://github.com/IanShelanskey/pyosc.git

After the new directory is create you can check to make sure everything installed correctly by typing:

ls

This command lists all of the folders/files in the current directory. You should see a folder called “devel.” This is what we just cloned from the GIT repository. You can mount this directory by typing:

cd ./devel

You can again use “ls” to see all of the files within the directory. One of them is called “setup.py” We want to run this file in order to use OSC. To do this you type:

sudo ./setup.py install

You might be prompted for your password since its a sudo command. After the command line stops installing, you can check to make sure everything installed properly by entering the python console and importing the library, like this:

python

Then:

import OSC

If it doesn’t return an error you have successfully installed pyOSC!

In the next tutorial I will go through the python code to send an OSC message. You can check examples of the code in action from this download.