SuperCollider: meeting the beast

SuperCollider came across my radar screen when looking for a way to generate my own non-repeating sound generators. I have trouble sleeping and I found that I kept “hearing the loop” on many of the generators you can get on an app store. Like “wait, I already heard that twig and then that bird in that exact order about 10min ago when I was also lying awake and trying to punch myself to sleep.”

I figured I could have pre-recorded .wav or .mp3 files of whale noises or whatever and somehow play them at random intervals. Minimum viable product. But oh, I found it does SO much more. For one, not only can it load audio buffers and do various things with them, it is also itself a tool for creating synths, but through code!

That fact hit my combo art / engineering itch. I like being able to create using code. It’s much less messy than paint.

After doing some research, I was shocked to see that it has been around since it’s inception in 1996, and I’m literally just hearing of it. Since the 1900s, it has been maintained by an open source community and that, I believe, has made it that utter beast that it is.

What can it do?

Here are some of it’s capabilities that I don’t think I will get to any time soon, because I’m focusing on generating non-repeating soundscape type things. However, you can also do the following things, just for example:

  • Algorithmic composition and generative music

    Not just random ambient events, but entire evolving structures. Meaning, you can compose classical-like compositions, but driven by probability and rules you define in code.
  • Live coding performance (a.k.a. “algorave”)

    People literally stand on stage, type code into SuperCollider, and the music changes as the code changes. The crowd can watch the text scroll while the beats mutate.
  • Physical modeling synthesis

    You can simulate instruments that don’t really exist: plucked strings made of glass, flutes with variable bore shapes, drums that stretch and wobble like rubber membranes.
  • Granular synthesis

    Chopping up a sound into thousands of tiny “grains” and then scattering them in time and space. You can turn a single violin note into a shimmering cloud, or a spoken word into a texture that feels an alien robot (why do aliens and robots always talk the same on TV? Just say it “I am a robot.” “I am an alien.” see?).
  • Spatialization and multichannel audio

    SuperCollider can pipe sound into setups with dozens of speakers, letting you swirl, bounce, and smear sound around a room (or a VR space).
  • Data sonification

    Turning scientific or mathematical data into sound. People use it to “listen” to stock markets, protein folding, or cosmic rays. People should use it to analyze whale sounds but they DON’T.
  • Interactivity

    SuperCollider can talk to sensors, cameras, and game controllers, so you could build an installation where people waving their arms or walking across a room triggers interactive audio synthesis, like at an art installation.

An engineering approach

One of the first languages I learned was PHP which is also open source and slightly older. There are a million ways to do anything in that language, and that is how SuperCollider seems to be. You can begin generating a simple program with a couple lines of code or arrange something into a large composition, and that can be done in any number of ways. This is why they introduced frameworks like Zend and Laraval to bring some semblance to what would otherwise be spaghetti code.

SuperCollider is like that. If you paste any of the following snippets into the SuperCollider IDE and hit CMD+Rtrn you will hear things:

// a basic example
(
{ SinOsc.ar(160, 0, 0.2) }.play; // 160 Hz sine at low volume
)
// a simple sine wave added to a modulation sine wave with pan and reverb
(
{
    var mod = SinOsc.ar(200, 0, 200);
    var sig = SinOsc.ar(440 + mod, 0, 0.2);
    sig = Pan2.ar(sig, SinOsc.kr(0.2)); // gentle orbit
    FreeVerb.ar(sig, 0.7, 0.9, 0.3)
}.play;
)
// alien-like cavern of stalagtites and stalagmites
(
{
    var trig = Dust.kr(20);
    var freq = TExpRand.kr(100, 1000, trig);
    var env = Decay2.kr(trig, 0.005, 0.1);
    var sig = SinOsc.ar(freq) * env * 0.2;
    sig = Pan2.ar(sig, LFNoise1.kr(1)); // jittery movement
    FreeVerb.ar(sig, 0.5, 0.8, 0.2)
}.play;
)
// a weird wind noise
(
{
    var sig = PinkNoise.ar(0.4);
    var cutoff = LFBrownNoise2.kr(0.5, 1.2, 0.3).range(100, 6000); // jittery LFO
    sig = RHPF.ar(sig, cutoff, 0.3);
    sig = Pan2.ar(sig, LFNoise1.kr(0.2));
    FreeVerb.ar(sig, 0.6, 0.9, 0.3)
}.play;
)

That last one sounds like something a foley artist would make with his / her mouth.

Then you take these sounds and compose something, at least I think that’s the idea.

Last thoughts

There are those that warn against approaching SuperCollider like a software engineer but in many ways I’m setting out to do just that. I have the beginnings of a framework which I hope to share soon. It helps me put together a composition without too much code repetition, a core software engineering concept. It’s a starting, and who knows, maybe that’s all the “framework” that is needed, stay tuned!

Here’s a small snippet of an underwater soundscape which will be one of my first to release very shortly:

Now get in there and do some colliding!