Control Sonic Pi 3 with a PS3 wireless controller

Recently I published a video on YouTube showing Sonic Pi 3 being controlled by a PS3 wireless games controller. This post contains a link to the software required to do this, should you wish to try it out.

Two files are included. The first, ps3.py should be run on a Raspberry Pi, into which the wireless dongle of the PS3 controller is plugged. Two pieces of supporting software need to be installed first.

sudo apt-get update
sudo apt-install joystick
sudo pip3 install python-osc

The second software file is a Sonic Pi 3 script, which should be loaded into a buffer on Sonic Pi 3, which can be running either on the Raspberry Pi, or on an external computer.

NB if you want to run Sonic Pi 3 on the Raspberry Pi you need to wait for the Raspbian Stretch to be released, or upgrade a new copy of Rasbian Jessie to Stretch yourself. The released version of Sonic Pi 3 will NOT run on Raspbian Jessie
This is specified on the command line when running the ps3.py script by adding an argument –sp xxx.xxx.xxx.xxx where xxx.xxx.xxx.xxx is the IP address of the computer running Sonic Pi.
In addition, on the IO preferences in Sonic Pi you must make sure that the option to receive remote OSC messages is ticked

To run the ps3.py file, make sure it is executable by typing:
chmod 755 ps3.py
then type
./ps3.py     or        ./ps3.py –sp xxx.xxx.xxx.xxx        Putting in the appropriate IP address of your remote Sonic Pi 3 computer.
As an alternative you can type python3 ps3.py
or         python3 ps3.py –sp xxx.xxx.xxx.xxx

The software can be downloaded from here

Leave a comment