The Foundations Of Synthesis In SuperCollider

For the uninitiated, SuperCollider is an audio synthesis platform oriented towards algorithmic composition. In human terms, this means you can write code that writes music. A lot of the compositions people make end up being spacious and stripped-down pieces of minimal electronica, and the upward potential seems fairly limitless with synthesis-based components and extensions such as oscillators, filters, and sequencers, along with a passionate community which has been innovating on the platform since inception. In this article, I want to explain how oscillator parameters are controlled and modified in the simplest possible terms!

INSTALLATION + VIM INTEGRATION

SuperCollider can be downloaded on the homepage, and I thought I would take a second to explain how I configured NeoVim to run the SuperCollider platform for all of you vim-thusiasts out there (this could perhaps be an article on its own, but I nonetheless felt it worthy of including). After installing SuperCollider above, there are two Github repositories you will need; SCVim and SuperCollider H4X. Installation is covered within the repositories, although if you are a NeoVim user like me, replace /.vim/ with /.config/nvim/ any time that it appears (a universal rule). Being a user of VimPlug, I found that I had to run :PlugInstall twice to get SCVim to install properly. The shortcuts are then listed on the SCVim repo, but in short, :SCVimStart opens the SC terminal window, Ctrl + E runs a particular line and F12 is a hard stop!

Isn’t it beautiful?!

FUNDAMENTAL BASICS

The essentials for producing sound in SuperCollider are a server and a unit generator. A server simply boots a host on a port which has the ability to compile and produce sounds from the code, and a unit generator is the fundamental building block of sound creation in SuperCollider, generally taking the form of an oscillator. Unit generators have 3 class methods:

  • .ar (audio rate)
  • .kr (control rate)
  • .ir (initialization rate)

These class methods return a new instance of the unit generator which calculates at the audio or control rate. By default, the audio rate will be assigned to the sample rate of your machine (generally 41,000) and the control rate will have the ability to modify parameters auxiliary to the assigned generator.

Unit generators accept four arguments:

  • Frequency in hertz (freq).
  • Phase offset or modulation (phase).
  • A value to multiply the output by (mul).
  • A value to be added to the output (add).

The first will control the pitch of the generator, the second will control potential changes to its frequency, and the last two will modify output controls such as amplitude. For the sake of this explanation, I will use a basic sine wave oscillator to produce a frequency at 440 hz. If you wish to follow along in SuperCollider or Vim, you only need to run three lines of code to start and stop this sound:

s.boot;               //starts the server
x = {SinOsc.ar(freq: 440, phase: 0, mul: 0.25, add: 0)}.play;
x.free; //stops the generator, server continues

So, to break down line two:

  • A variable, x, is created so the value can be operated on.
  • An object containing the unit generator is then initialized, SinOsc, followed by the audio rate class method.
  • The arguments are declared which model the oscillator.
  • The .play method is called activating the unit generator.

CONTROLLING UNIT GENERATORS WITH OTHER UNIT GENERATORS

Just in case producing an A440hz sine wave wasn’t enough to get you ecstatic about learning SuperCollider, I wanted to include one more slightly more complex example in which a control unit is controlling a control unit and produces a frequency LFO on a sine oscillator!

I will post the code and then explain it as I did above:

(
y = {
var freq, sig;
freq = LFNoise0.kr(freq: 8, mul: 400, add: 600);
sig = SinOsc.ar(freq);
}.play;
)

Here’s what’s happening with this one:

  • Parentheses are created to store the object with multiple values.
  • A variable is created and declared as an object.
  • The parameters of both “frequency” and “signal” are defined.
  • Frequency is declared as LFNoise0 followed by a control rate class method, meaning the values passed as arguments will ultimately be modifiers applied to the frequency of the oscillator.
  • The arguments are declared (there is no “phase” argument for the LFNoise as its whole objective is modifying values).
  • The signal is declared as the sine wave oscillator which we used before, given the audio rate class method, and the “freq” variable is passed in as an argument, which contains the line of code above it.
  • The .play method is launched, initiating the generator!

I hope this made some sense and that you enjoyed reading about or experimenting with SuperCollider. I am looking forward to writing more about this language in the future.

Until next time!

--

--

--

Programmer / Artist / Believer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Vineyard: LGE Information & FAQ

SLAE #2: Shell Reverse TCP

Create random numbers in python

Major Challenges Faced in Developing Mobile Apps for Smart Devices

Code Coverage Analysis Using Codecov and Codefresh

THM: c4ptur3-th3-fl4g

Design Pattern Chronicles 1 — The Strategy Pattern

Which Technology, platform and company to select as a new developer: data driven approach

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Lucas Thinnes

Lucas Thinnes

Programmer / Artist / Believer

More from Medium

Camphor in Medieval Persian Poetry

The Evolution of the Old-School Accounts Payable Process.

Biostasis2021 Conference Results

Hanging Out With Henry VIII Live! (For Now): The Mirror and The Light