TenMinuteTutor

Coding, maths and art

Getting started with Supercollider

What is SuperCollider? According to its website:

SuperCollider is a platform for audio synthesis and algorithmic composition, used by musicians, artists, and researchers working with sound. It is free and open source software available for Windows, macOS, and Linux.

SuperCollider provides a simple programming language which you can use to create sounds and music.

You can take a traditional approach of programming a set of different musical instruments, and coding each instrument to play a sequence of notes to create a complete musical piece. Alternatively, you can use algorithms to determine the sequence of notes to create a computer generated composition. Or you could abandon the idea of notes and instruments altogether, and create works based on abstract sounds.

If you are brave, you can even perform live, altering the code as you go, composing the music as it is played, in front of an audience.

Perhaps the most interesting idea is to combine any or all of these techniques, for example using a precomposed sequence as the basis of your music, and adding live or algorithmic improvisations on top.

Getting SuperCollider

The good news is that SuperCollider is free, open source, and works on Windows, Linux and Macs. You can download it from github.

Follow the instructions on the site to install it on your computer.

Running SuperCollider

When you run the SuperCollider program, the following window will appear (without the red labels, of course):

main window

This window is the SuperCollider IDE (Integrated Development Environment). There are four main parts:

  • The Code window is where you type in the code that creates sound.
  • The Post window is where SuperCollider displays any messages, for example if you code contains errors. If your code doesn’t create any sound at all, check here for error messages.
  • The Help window shows pages from the extensive SuperCollider help system. SuperCollider is massive, with many features, so even when you have learnt the basics there are still lots of other features to try.
  • The Server Status bar is explained next.

How SuperCollider works

SuperCollider is made up of two separate programs, and it is important to understand a little bit about how they fit together.

The first program is the one that you can see, the SuperCollider IDE. This how you interact with SuperCollider, and where you type in the code to define the sounds you want.

The second program, the SuperCollider Server, runs in the background. Although you can’t see this second program, it is very important, because it is the server that actually makes the sounds.

architecture

A third important part of the system is the programming language, called sclang, that lives inside the IDE. Here is how the elements work together to create sounds:

  • Using the IDE, you type in sclang code to define a sound.
  • You run the code in the IDE.
  • The IDE interprets the code, and sends instructions to the Server.
  • The Server plays the sound.

You don’t need to worry too much about the server, you just need to remember to start it when you open SuperCollider (see next section).

Creating your first sound

There are a few simple steps to creating your first sound.

Step 1 - start the server. When the IDE first starts, the server doesn’t start automatically. To start it going, you must select the menu item Language|Boot server. As the server starts running, you will see some messages is the Post window, and you will also see some activity is the Server status bar. This shows how much CPU the server is using, and it will typically be about 1% when the server is idle (no sound being produced).

You can also use the shortcut Ctrl-B instead of the menu item.

You only need to run the server once, when you open SuperCollider. When the server is running, the Language|Boot server item will not be present in the menu.

Step 2 - write your code. As an example, this code creates a single note that plays forever:

{SinOsc.ar(440, 0 , 0.1)}.play;

Type this code into the Code window, but notice that it doesn’t play a sound yet.

Step 3 - play the sound. To make the sound play, position the cursor anywhere on the line of code and press Ctrl-Enter (hold down the Control key and press the Enter key). You should hear a continuous, pure tone. It will keep playing forever.

Step 4 - stopping the sound. Some sound, such plucking a guitar string or hitting a drum, last a short time and then stop. Other sounds, like our continuous tone, will go on for as long as you want them to, or maybe even longer.

To stop all sounds, use Ctrl-Period (the Control key plus the period, or full stop, key .)