Introduction: SuperCollider: Your First Oscillator
This tutorial provides a very basic introduction to generating sound in SuperCollider. SuperCollider is an open source language and environment for sound synthesis. In this tutorial, you will learn how to install SuperCollider, boot the sound synthesis server, execute lines of code, and stop running code. By the end of this tutorial you'll have your very own 440Hz sine tone!
For more information about SuperCollider, please visit the SuperCollider website.
Step 1: Download and Install SuperCollider
In order to successfully use SuperCollider, you're going to need to get SuperCollider! SuperCollider is available on most operating systems including Mac (intel and PPC) and Windows, as well for a few distributions of Linux. You can download Supercollider HERE.
Once you have successfully downloaded SuperCollider, go ahead and navigate to wherever it is you have installed it (if you are on a Mac, the Applications Folder, in a Folder named SuperCollider). To open, click the SuperCollider icon.
SuperCollider's workspace consists of three major parts: the code editor, help browser, and post window. The code editor is where you will type new lines of code and execute them. The help browser is a useful resource for finding out more about various parts of syntax and functions that are built into SuperCollider. The post window is where the result of whatever you execute is printed, and is useful for debugging and making sure everything is working as it should.
And there you have it! SuperCollider!
Step 2: Boot Server
In order to execute sound synthesis code in SuperCollider (and to hear sound), you must boot the server. As explained in the intro, SuperCollider is an object-oriented language which functions as a network client to a realtime sound synthesis server.
The default server can booted in two ways, through an executable line of code or through a key command. For the sake of working across different operating systems, I will demonstrate the code version of starting the server.
This will be your first line of code in SuperCollider!
s.boot;
Once you've typed that code into the code editor section, you will need to execute it. To execute your first line of code, click just after the semicolon. Once the line is selected press COMMAND+RETURN (if using a Mac) or CTRL+ENTER if using Windows or Linux.
If all went according to plan, something akin to the following (your I/O devices may differ) should have printed in the post window:
booting 57110
localhost Number of Devices: 2 0 : "Built-in Microph" 1 : "Built-in Output"
"Built-in Microph" Input Device Streams: 1 0 channels 2
"Built-in Output" Output Device Streams: 1 0 channels 2 SC_AudioDriver: sample rate = 44100.000000, driver's block size = 512
SuperCollider 3 server ready. Receiving notification messages from server localhost Shared memory server interface initialized
Once your server is booted, you're ready to code your first oscillator!
Step 3: Hello Sound: Your First Line of Code
Now that the synthesis server is running, you can finally code your first sine oscillator! Your second line of SuperCollider code will be just as exciting as your first!
{SinOsc.ar(440,0,1,0)}.play
But what does it mean!?
Let's break it down part by part:
{ SinOsc .ar ( 440, 0, 1, 0 ) } .play <br>
- The enclosing curly brackets ({}) signify that this is a function: a block of code that will do something.
- SinOsc is a UGen or Unit Generator. Unit Generators are the basic building blocks of synths on the server, and are used to generate or process audio or control signals. SinOsc takes four arguments (Frequency, Phase, Multiply, and Add)
- .ar specifies that we are generating an 'Audio Rate' signal (.ir stands for information rate)
- Inside this set of parentheses are our arguments
- Our Frequency is currently set to 440Hz, you can set this number to any Frequency within the audible range
- Phase is set to 0. You can offset the phase of your sine wave signal if you so desire (this will not be particularly impactful if you only have one waveform)
- Multiply designates what our output is multiplied, I do not recommend going above 1 here as you may encounter clipping. This argument essentially controls the amplitude of the output.
- Add is the value to be added to the output signal. We won't worry too much about this for now.
Okay! Now you're almost ready! Let's go on...
Step 4: Execute Code
Now it's time to make some noise! But before you start your fancy new oscillator oscillating, I am going to tell you how to stop it (this was a lesson hard won for me in my infinite stubbornness). If you are using a Mac, to stop any signal in SuperCollider at any time, click within the SuperCollider window and press COMMAND+. (period). If you are using a PC, press CTRL+. (period).
I tell you this ahead of time because the first time I made sound in SuperCollider I spent 5 minutes listening to insanely high frequency tones while I frantically googled how to stop them.
Okay! Let's execute that code! As you may remember from when you booted the server, you have to select your code to execute it. Since this code is only one line, you can simply click on the same line anywhere after the semicolon, or doubleclick to highlight your code.
Now that you have your code selected, Mac users, press COMMAND+RETURN, Windows users, press CTRL+ENTER.
You should hear a nice 440Hz tone! Hooray! Your first oscillator!
Step 5: Next Steps
Now you've done it! You've made your first Oscillator! So what next? Well, there's a lot you can do with just the SinOsc UGen in SuperCollider. For instance, you could make multiple oscillators at different frequencies (perhaps harmonically related). You can also shift the phase of two Oscillators at the same or harmonically related frequencies (try setting the phase to 1, see what happens in either case).
You can also save your awesome oscillator so you can play with it again later! Click under File and select Save or Save As. Choose where to save your file. I recommend saving your file as a .scd file.
That's it! Stay tuned for more.