SuperCollider on the Raspberry Pi

Posted on Fri Nov 02 00:00:00 -0400 2012

As some of you will know, I’ve spent the last few years hacking furiously on something called Overtone which is a new language front-end to the sound synthesis server SuperCollider written in Clojure. We’ve make a large amount of progress with it and adoption is continuing to grow amongst the programming community. Here’s an example of it in action:

More recently I’ve joined the Raspberry Pi team for a few months to figure out how much I can port across to the small confines of the Pi with an eye on making something useful for engaging school children with a more modern computer science curriculum.

The first step was obviously to get SuperCollider running on the Pi. This unfortunately proved to be much more tricky than apt-get install supercollider. After a good while of running into dead ends, a remarbly kind chap called Stephan Lachowsky helped put the final pieces of the puzzle together - so many thanks to him. I’ll walk you through this final process so you too can get the crazy synth sounds out of the Pi. Hopfully future updates will render this post redundant, but until that time I hope it helps you out.

Initial Setup

First, let’s get some base dependencies installed:

  • Get a terminal connection to your Pi (either by sshing into the Pi itself or by opening up the Terminal app).
  • Update your packages: sudo apt-get update
  • Install Jack 2: sudo apt-get install jackd2
  • Install supercollider: sudo apt-get install supercollider

Install Jack2 v1.9.8

Under Linux, the latest versions of SuperCollider requires Jack to make sound. Unfortunately, the version of jackd2 that apt-get just installed is currently broken. If you try running it, you get a remarkably unhelpful Bus Error message as it dies due to struct alignment errors.

The solution: either wait until Jack or the compiler (whichever turns out to be the culprit) is fixed, or compile and install an older version which doesn’t suffer from the errors. It just so happens that version 1.9.8 works perfectly well. So, either download the source and compile it yourself, or follow these steps to set up a pre-compiled jackd2 binary available here.

  • Move into your home directory: cd ~
  • Fetch the Jack binary: wget
  • Unpack the binary: tar xf jack_for_pi_v1.9.8.tar.gz
  • Update your PATH: export PATH=/home/pi/local/bin:${PATH}
  • Ensure the library is visible: export LD_LIBRARY_PATH=/home/pi/local/lib
  • Test that jackd points to the newly downloaded version: which jackd should point to /home/pi/local/bin/jackd

Start Jack and SuperCollider

Next we need to do a bunch of things:

  • Start Jack in dummy mode - i.e. it doesn’t talk directly to any sound card but can be connected to from external apps.
  • Start alsa_out which does talk directly to the sound card, and can be connected to Jack to receive audio. (This is necessary because the Pi’s soundcard doesn’t currently support mmap which is required for direct Jack -> sound card connectivity).
  • Start scsynth, the SuperCollider server.
  • Connect both left and right channels within SuperCollider to alsa_out.

This can all be achieved by copying the following to a file such as ~/bin/start-sc:


jackd -m -p 32 -d dummy &
sleep 1
alsa_out -q1 2>&1 > /dev/null &
sleep 1
scsynth -u 4555 &
sleep 1
jack_connect SuperCollider:out_1 alsa_out:playback_1 &
jack_connect SuperCollider:out_2 alsa_out:playback_2 &

Now, give your file an execute bit: chmod u+x ~/bin/start-sc and start it up:


If you see the following, SuperCollider’s server, scsynth, should be running and listening for UDP packets on port 4555 (don’t worry about the Zeroconf warning):

jackdmp 1.9.8
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2011 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
JackDriver: client name is 'SuperCollider'
SC_AudioDriver: sample rate = 48000.000000, driver's block size = 1024
SuperCollider 3 server ready..
Zeroconf: failed to create client: Daemon not running

If you’re using Overtone, you can connect to it from a remote machine with:

(use 'overtone.core)
(connect-external-server "ip address of your pi" 4555)
(demo (sin-osc)) ;=> Plug in some headphones to hear a
                 ;   sine wave on the Pi's audio jack.

Have fun and happy hacking!

blog comments powered by Disqus

Recent Posts