SC-01 Basics

SuperCollider - Tutorial 01 (Basics)

Originally authored by Gaisai Haolah

These document are heavily influenced by two very talented SuperCollider programmers Celeste Hutchins and Gaisai Haolah. I have no skill of my own to portray at least not with SuperCollider so I have stolen relevant snippets from these programmers to demonstrate some of the workings of the SuperCollider application.

Needed

  • Start Applications >> Audio & Video >> JACK Control
  • If top left Start button is Green select it
  • This needs to start with no errors
  • Start Applications >> Accessories >> Text Editor (Gedit)
  • Start Tools >> SuperCollider mode
  • Start from SuperCollider menu >> Start Server
  • Monitor the lower Text Editor (Gedit) display for errors

Term Definitions used in this Tutorial

  • postln = Print or post message
  • SinOsc = Sine Oscillator
  • RLPF = Reasonant Low Pass Filter
  • Saw = Saw Tooth Oscillator
  • LFNoise1 = Low Frequency Noise
  • play = Play sound to Audio O/P
  • .ar = Audio Rate (eg. SinOsc.ar)
  • .kr = Control Rate(eg. SinOsc.kr)
  • mul = Multiples
  • add = adding something

This Tutorial

Basic's 01 is an introductory level tutorial for SuperCollider in this tutorial we aim to look at and produce simple sounds of a single tone using the SinOsc (Sine Oscillator) command. This is the easiest way to create a tone of a specific defined value, although we are not actually interested in producing anything other than a noise to prove a function or functions.

Place this code into your Text Editor and use a blank template

( // Move edit cursor and press CTRL+E here to run



)

We recommend you use the above as a template at the moment it has no code within it to perform an action or output visual or audio, a clean slate if you will. At the very top of this code is an opening bracket followed by // Move edit cursor and press CTRL+E here to run, this is actually what's known a a remark statement these can be placed anywhere within the code portion (between the brackets) try to place any other type of command and the code will fail to run, even when a valid statement is entered.

We just can not proceed further without doing the immensely stupid "Hello, World" to prove that what you are manipulating is code and all code must exist within the brackets

( // Move edit cursor and press CTRL+E here to run
"Hello, World!".postln;
)

Now move and place the mouse cursor on the line the begins "//" anywhere on this line will suffice, press CONTROL key plus "E". You should see "Hello, World" printed two times in the Monitor window (lower Text Editor screen display). The string is duplicated because "postln" returned the same string as a value, and the output also prints the results of the evaluated expressions.

Thus far we have generated code that does nothing more than print a line of text and into the Monitor screen at that, not much good really especially if it is sound or audio you are more after.

( // Move edit cursor and press CTRL+E here to run
{SinOsc.ar}.play;
// Press ESC to end
)

Ok it does't do much just produces a single tone sound hopefully from your left speaker. Why does it play only on the left, we think because we read from left to right the code is also read from left to right, therefore precedence dictates that the order of sound will first be left then right, lets test that theory with the following code.

( // Move edit cursor and press CTRL+E here to run
{[SinOsc.ar, SinOsc.ar]}.play;
// Press ESC to end
)

We have encompassed in the same code in curly brackets with an extra command and some square brackets, other than that nothing has changed, with the exception both speakers emit a sound the same sound, so lets see what you make of this code instead.

// This example is a modified patch
// from the SuperCollider book by David Cottle
// You can enable syntax highlighting
// by selecting View->Highlight Mode->Others->SuperCollider
( // Move edit cursor and press CTRL+E here to run
{
RLPF.ar(Saw.ar(55),
LFNoise1.kr([5, 5], mul: 440, add: 880),
0.1,
mul: 0.25
)
}.play;
// Press ESC to end
)

You probably think we are jumping the gun a bit with this one given it's obvious complexity and you would be right, where we can we would like to delve deeper into the mysteries of SuperCollider by presenting an example that does a little bit more than just make a noise or single tone sound.

Note the brackets around the actual code. They're used to group code together into "blocks" and execute SuperCollider instructions simultaneously. In this example you will need to press CTRL+E where indicated to select and run our block. Remember, that you can shutdown the sound anytime with ESC! :)

As you can see, we have a Saw oscillator, connected to a resonant low-pass filter (RLPF) here and the cutoff frequency is controlled by an interpolated random value (LFNoise1). You can open reference pages for the respective modules (UGens) by positioning the cursor over them and pressing CTRL+U, but make sure that you install supercollider-doc package to get those.

Well, we hope this tutorial will help you get started with SuperCollider. Make sure you also stop by the SuperCollider website and the wiki for more tutorials and examples. Hopefully we have wetted your appetite for SuperCollider this small Tutorial is just the start for further information it is suggested you visit the following site SuperCollider Help Files

Back << SC00 Introduction || SC02 Basics >> Forward