home/ modules/ supercollider-synthesis-and-synthdefs

SuperCollider: UGens, SynthDefs and synthesis

  • learner can build a UGen graph and wrap it in a reusable SynthDef
  • learner can shape sound with envelopes, filters, and modulation/synthesis techniques
  • learner can route audio on buses and control node ordering and lifecycle

Write a self-freeing SynthDef with an ADSR-gated envelope and a subtractive/FM voice, instantiate it as a Synth, route it through an effect Synth on an audio bus with correct node ordering, and control it live with .set.

This module is where SuperCollider stops being a calculator that beeps and becomes an instrument you can gig with. The whole task is the anatomy of every serious SC rig — a techno bassline synth feeding a shared reverb, a drone set held open by a gate, an ambient pad retuned mid-piece — all of it reduces to one skeleton: a voice defined once as a SynthDef, spawned as nodes, wired through effect buses in the right order, and steered live. Get this skeleton wrong and you get the classic on-stage failures: silence because the effect reads its bus before the source writes, or a server choking on zombie nodes an hour into a set.

The arc starts supported: nest a couple of oscillators into a filter, hearing how “SuperCollider sounds are built from networks of Unit Generators wired by nesting” makes code mirror signal flow, and use the rate and polarity atoms plus “.range” rescaling as JIT references when a modulator misbehaves. Then freeze a working graph into a named recipe (“SynthDef names and stores a reusable synth recipe”), swap the fixed amplitude for an ADSR whose gate you open and close by hand, and add doneAction: 2 so notes clean up after themselves. The last supported step splits voice from effect across an audio bus, leaning on the node-ordering principle to place the effect after its source. The capstone then asks you to assemble the whole chain unaided.

Required atoms are exactly the gates: graph-building, envelope/gate lifecycle, subtractive and FM voicing, bus routing and execution order. Supporting atoms widen the palette afterward — multichannel expansion and alternate range-scaling approaches for more complex rigs, Groups and SynthDef conventions for bigger rigs, panning and Lag for polish, sample playback, additive and physical-modelling voices, and live input.

Runnable examples

Generated from the context/ instrument corpus by concept (redistributable idioms only). Do not edit — regenerate with gen-module-examples.mjs.

drone

osc 55 >> audio

punctual-0001 · CC0-1.0

SinOsc s => dac;

chuck-0001 · MIT

lowpass-sweep

Noise n => LPF f => dac; 0.2 => n.gain;

chuck-0003 · MIT

s("hh*8").lpf(sine.range(200,4000).slow(4))

strudel-0015 · CC0

adsr-envelope

note("c3").s("sawtooth").attack(0.01).decay(0.1).sustain(0.6).release(0.3)

strudel-0205 · CC0

{ Saw.ar(220) * EnvGen.kr(Env.perc(0.001, 0.2), Impulse.kr(2)) * 0.3 }.play

supercollider-0013 · CC0

fm-timbre

note("c3").s("sine").fm(4).fmh(2).fmi(3)

strudel-0204 · CC0

osc (midicps 24 * (1 ~~ 4 $ osc 110)) >> audio

punctual-0006 · CC0-1.0

modulated-range

s("hh*8").pan(sine.range(0,1).slow(2))

strudel-0037 · CC0

zoom (1 ~~ 2 $ osc 0.25) (circle 0 0.3) >> add

punctual-0022 · CC0-1.0

ring-modulation

osc 440 * osc 220 >> audio

punctual-0004 · CC0-1.0

{ (SinOsc.ar(440) * SinOsc.ar(221)) * 0.2 }.play

supercollider-0004 · CC0

stereo-panning

d1 $ pan (slow 2 sine) # sound "hh*8"

tidal-0037 · CC0

SinOsc s => Pan2 p => dac; -0.7 => p.pan;

chuck-0042 · MIT

additive-synthesis

{ Klang.ar(`[[100, 200, 300, 400], [0.4, 0.3, 0.2, 0.1]]) * 0.1 }.play

supercollider-0022 · CC0

generative-mutation

use_synth :prophet; play (scale :e3, :minor).choose + [0, 12].choose; sleep (ring 0.5, 0.25).choose

sonicpi-0045 · CC0

physical-modeling

Mandolin m => dac; 0.9 => m.pluck; 220 => m.freq;

chuck-0043 · MIT

Atoms in this module

Required — these gate the capstone

A Unit Generator (UGen) is an object that generates or processes signals entirely in the server
Concept L1 Foundations FB
SuperCollider sounds are built from networks of Unit Generators (UGens) wired by nesting
Concept L2 First instrument FB
UGens run at audio rate (.ar) or control rate (.kr), trading CPU for update resolution; only .ar signals reach the speakers
Concept L1 Foundations FB
UGens are either unipolar (0 to 1) or bipolar (-1 to +1); knowing which is essential before routing their output
Concept L1 Foundations FB
SynthDef names and stores a reusable synth recipe in the server; Synth instantiates it with specific argument values
Procedure L2 First instrument FB
A SynthDef is a reusable named synth recipe; a Synth is a running instance of it
Concept L2 First instrument FBN
Every running synth is a node in the server's Node Tree; .free removes one node, ctrl+. frees them all
Concept L2 First instrument FBN
The .set message changes a running synth's arguments in real time while the synth continues playing
Procedure L2 First instrument FBN
SuperCollider's Env class defines a breakpoint envelope that EnvGen (or the .kr shortcut) plays back as a control signal
Concept L2 First instrument FB
Sustained (ADSR/ASR) envelopes require a gate argument: gate=1 opens the envelope, gate=0 triggers release
Concept L2 First instrument FB
doneAction: 2 tells a UGen to free its enclosing synth node when it finishes, preventing silent zombie synths
Concept L2 First instrument FBN
SuperCollider routes audio between synths on numbered buses; Out.ar writes, In.ar reads, and Bus.audio allocates free buses
Concept L2 First instrument FBN
SC server executes synth nodes top-to-bottom in the Node Tree; source synths must precede effect synths or no audio flows
Concept L2 First instrument FBN
In SuperCollider, effects buses require correct node ordering so the effect Synth reads the source Synth's output
Principle L3 Craft FB
The .range(lo, hi) method rescales any UGen's output to a desired numeric range; mul/add provide equivalent lower-level control
Procedure L2 First instrument FB
Frequency modulation drives a carrier oscillator's frequency with a modulator, generating sidebands at C±kM
Concept L2 First instrument FB
Subtractive synthesis sculpts a complex source by filtering away unwanted frequencies
Concept L2 First instrument FB

Supporting — enrichment, not gating

UGen output is scaled to useful ranges using .range, mul/add arguments, or linlin/linexp methods
Concept L2 First instrument FB
Setting doneAction:2 in an envelope automatically frees a Synth when the envelope finishes
Principle L2 First instrument FB
Passing an array to a UGen argument duplicates the whole signal graph, one copy per array element
Concept L2 First instrument FBN
Subtractive synthesis removes frequencies from a rich source using resonant low-pass or high-pass filters
Concept L3 Craft FB
MouseX and MouseY turn cursor position into live control signals, making a synth playable in real time
Concept L2 First instrument FN
SoundIn.ar reads from the sound card's input buses; use headphones to prevent feedback
Concept L2 First instrument FN
SC Groups organize synth nodes into named sections that can be targeted for routing and order-of-execution control
Concept L3 Craft FN
A live-coding SynthDef names its frequency arg 'freq', exposes an 'out' arg, and self-frees via doneAction
Procedure L3 Craft FN
ServerBoot and ServerTree callbacks ensure SynthDefs and resources load in the correct order after server boot
Concept L3 Craft F
An overdriven DFM1 filter self-oscillates into a warm drone that layers across the harmonic series
Procedure L4 Performance FNB
Physical modelling synthesis uses an excitation signal driving a resonant body model
Principle L3 Craft FB
Additive synthesis builds complex timbres by summing sine waves at chosen frequencies and amplitudes
Concept L2 First instrument FB
PlayBuf.ar loads an audio buffer and plays it back with variable speed, direction, and looping
Procedure L2 First instrument FBC
PlayBuf.ar plays back audio files loaded into server buffers; rate controls speed and direction
Concept L2 First instrument FN
Pan2 places a mono signal in a stereo field; its pos argument ranges from -1 (left) to +1 (right)
Procedure L2 First instrument FB
Mix folds a multichannel array to mono; Splay spreads it evenly across a stereo field
Procedure L2 First instrument FB
The Lag UGen smooths abrupt parameter changes by creating a linear ramp over a specified duration
Concept L2 First instrument FB
Control buses route modulation signals between synths so one modulator can drive many
Concept L2 First instrument FBN
Glicol suits ambient drones because its modular graph natively sustains and slowly modulates signals
Fact L2 First instrument FB