2. Intro to SC3

Download

Go here to download the Current Version of SuperCollider 3 (3.9.0 as of this writing). Once your download is complete, go ahead and install.

About

Supercollider is made up of two applications: a language interpreter and one or more synthesis servers. All communication between the lang (short for language) and the server is done via OpenSoundControl.

Starting the server

In order to make sound the server must be running. Type the following into a new window (<Command+N> makes a new window) and then hit <Shift+Enter> on the same line to execute the code:

s.boot;

Here s refers to the localhost server on your CPU.

s.boot; generally results in something like this in the post window:

booting server 'localhost' on address: 127.0.0.1:57110
Number of Devices: 17
   0 : "Built-in Microph"
   1 : "Built-in Output"
   2 : "After Effects 10.5"
   3 : "After Effects 11.0"
   4 : "After Effects 11.0.1"
   5 : "After Effects 11.0.2"
   6 : "After Effects 12.0"
   7 : "After Effects 12.2"
   8 : "After Effects 13.0"
   9 : "Prelude 1.0"
   10 : "Prelude 2.0"
   11 : "Premiere Pro 5.5"
   12 : "Premiere Pro 6.0"
   13 : "Premiere Pro 7.0"
   14 : "Premiere Pro 8.0"
   15 : "MOTU UltraLite mk3 Hybrid"
   16 : "Aggregate Device"

"MOTU UltraLite mk3 Hybrid" Input Device
   Streams: 4
      0  channels 8
      1  channels 2
      2  channels 2
      3  channels 2

"MOTU UltraLite mk3 Hybrid" Output Device
   Streams: 4
      0  channels 2
      1  channels 8
      2  channels 2
      3  channels 2

SC_AudioDriver: sample rate = 44100.000000, driver's block size = 512
SuperCollider 3 server ready.
Requested notification messages from server 'localhost'
localhost: server process's maxLogins (1) matches with my options.
localhost: keeping clientID (0) as confirmed by server process.
Shared memory server interface initialized

One can quit the server by executing the following code:

s.quit;

Functions

Similar to most other programming language, Functions in SC are denoted by the use of curly brackets. Anything between { } is a function.

For Example

f = { "hello world!".postln; };
f.value;

The first line of code stores the function at f, whereas the second line returns the value (in this case, prints the message "hello world!" to the post window) associated with the function. Here value is short for evaluate. If one needs to use a function simply .value it.

Arguments and Variables within Functions

Arguments allow one to pass values to a function when the function is called.

For Example

(
f = { arg a, b;
    a - b;
};
f.value(5, 3);
)

In the above code, evaluating the f.value(5, 3) results in the number 2 at the post.

And, of course, one can also use variables in functions.

For Example

(
f = { arg a, b;
    var firstResult, finalResult;
    firstResult = a + b;
    finalResult = firstResult * 2;
    finalResult;
};
f.value(2, 3);    // this will return (2 + 3) * 2 = 10
)