SuperCollider: getting started


During the course we will be using the SuperCollider 3 environment running on our Linux workstations. There are a few things you need to do before your environment will work. I'll try to describe in detail what you need to do...

Starting Jack

If you know how to start Jack just do it and skip to the next section... otherwise:

SuperCollider uses Jack as the audio input output engine so you will need to have Jack up and running before starting the SuperCollider environment. The easiest way to start Jack is through the Qjackctl GUI interface which you can start from your "Applications" "Sound and Video" menu. Click on it and you should see something like this:

If this is the first time you start Jack it would be a good idea to check some of its configuration options. Once Qjackctl starts you can press the Setup button to get to the setup screen.

First make sure that the Server Path is "jackd" (you could have a very old account from when that was jackstart). In the Parameters section you should have "Realtime" checked as well as "Unlock Memory". The "Frames/Period" setting will be initially 1024 and directly influences the latency of the system (see the Latency box at the bottom right of the setup screen for how long it is with your current settings). I routinely use 128 for fast response in interactive situations. The "Interface" should be pointing to "hw:0" which is the first sound card. Press "Ok" if you have changed anything.

You can now press the "Start" button and the Jack server should get started.

Configuring Emacs

We will be running SuperCollider from within the emacs text editor. First add the following two lines to your "~/.emacs" emacs configuration file.

;;; supercollider configuration
(require 'sclang)

You can do that by editing that file with emacs:

emacs ~/.emacs

Save your changes and quit emacs for now.

Preparing a working directory

SuperCollider needs a few directories around when it starts so begin by selecting a directory where you will be working with SuperCollider. It could be something like "~/supercollider/", or "~/220b/sc/" or whatever you prefer. You just need to remember to always start SuperCollider from within that directory. In the following instructions we will assumed you have selected "~/220b/sc/" as your SuperCollider working directory.

Create the directory tree:

mkdir -p 220b/sc/synthdefs
mkdir -p 220b/sc/sounds

And then change to that directory:

cd 220b/sc

Now you are ready to start SuperCollider.

Starting SuperCollider

To start SuperCollider just change to the correct directory:

cd 220b/sc

and then type (you do have Jack running, right?):

emacs -sclang

you should see window with two panes, in the lower pane you will see SuperCollider printing messages as it starts. After a bit it will look like this:

the top pane is a text area which you can use to type SuperCollider expressions and send them to SuperCollider. The bottom pane is actually the output of the sclang process which you will be interacting with. It is not a "file", it is actually SuperCollider running within emacs.

Booting SuperCollider

While SuperCollider is actually running at this point there is no server booted by default so let's start one. In the top pane (the "SuperCollider Workspace" pane) type:


put your cursor anywhere on the line you just typed and press Ctrl-c twice (that's the Control Key together with the "c" key, twice). You should see output in the bottom pane as SuperCollider reports on the process of booting the server. The end result will be something like this:

You could also have booted the server by placing the cursor in the line you typed and using the "SCLang" menu access the "Evaluate Line" entry. Same thing, only slower (your only gain is excersizing the mouse). Long term it pays to learn the emacs key shortcuts for most common operations.

once the server is up and running you are ready to make noise! You should be able to see the audio ports and connections in the Qjackctl "Connect" window.

From now on any SuperCollider file you edit in emacs (ending in ".sc") will automatically be in "SuperCollider mode" and you will be able to use the key shortcuts or the "SCLang" menu to send stuff to the server.

Getting SuperCollider to go "beep"

Open a new file with a file name ending in ".sc" and add this SuperCollider code to it:

s = Server.local.boot;

// statements enclosed in ( ) on separate lines should be executed
// together, either by double clicking on the first parenthesis and
// evaluating the region, or by pressing C-M-x inside the expression.

// create a new SynthDef and send it to the server
SynthDef("tutorial-sine", { arg out=0, amp=1.0, freq=440, i_dur=1.0;
	var env, sine;
	// i_* arguments are fixed at instantiation time and cannot be modulated
	// doneAction 2 means free the synth node when the envelope has finished
	env =, 0, i_dur, doneAction: 2, mul: amp);
	// the mul ugen input is usually more efficient than *
	sine =, mul: env);
	// output two channels on bus 0, [sine, sine]);

// node object style
	var freq, dur; 
	freq = 440;
	dur = 1.0; { arg i;
		// use Synth.grain rather than because the
		// Synth deallocates itself, so we don't need a node id
			// see C-c C-h Synth
			["amp", 0.2, "freq", freq, "i_dur", dur],

you have already booted the server so the first line should already be done.

Now double click on the starting parenthesis of the first SuperCollider expression and press Ctrl-c and then Ctrl-x (or use the "SCLang" menu and evaluate the region). SuperCollider should print "a SynthDef" - which just means it received a synth definition. Then double click on the start parenthesis of the second SuperCollider expression and evaluate it. You should hear four beeps coming from the audio interface.

Have fun!