home/ modules/ supercollider-patterns-and-event-sequencing

SuperCollider: patterns and event sequencing

  • learner can sequence events with Pbind, pitch/scale/chord and tempo keys
  • learner can compose and modify pattern streams live with the Pattern library
  • learner can schedule concurrent streams on TempoClock with Routines and fork

Compose a SuperCollider piece driven by layered Pbinds (melody, chords, rests) playing custom SynthDefs, modify a running stream live with Pbindef/Pdefn, and schedule sectioned entrances with fork on a TempoClock.

This module is where SuperCollider stops being a synthesizer and becomes a band. You already build custom SynthDefs; now you write the score that plays them — the declarative pattern layer that powers everything from generative ambient sets to on-stage algorave performance, where a piece must run, evolve, and change section without you ever touching a stop button.

The arc starts small: a single Pbind playing the default synth, understanding it as a score whose keyword streams (pitch, duration, amplitude) each pull from a pattern. From there you swap in your own instruments (Pbind can drive any custom SynthDef by naming it with \instrument), pick a pitch namespace deliberately (degree vs note vs midinote vs freq), and shape a real musical surface with named scales, nested-list chords, explicit Rest durations, and a TempoClock instead of the silent 60 BPM default. The pattern-generator trio — Pseq for ordered lines, Prand for constrained shuffle, Pwhite for continuous jitter — should become reflexive; they are drilled deliberately because live sets depend on swapping them without thinking.

The second half turns composition into performance: storing the EventStreamPlayer so streams can be stopped individually, then reaching for Pbindef and Pdefn to rewrite a single key or a shared value pattern while everything keeps running. Finally, fork on a TempoClock acts as the director, launching layered Pbinds with beat-accurate waits — exactly how the capstone’s sectioned entrances are built.

Every required atom is load-bearing for that capstone: pitch/chord/rest keys, the pattern vocabulary, live-modification proxies, and clock-driven scheduling all appear directly in it. Supporting atoms enrich rather than gate — random walks, per-event functions, wrapAt cycling, the Event type system, and perspective on why constrained live-coding languages emerged from this very pattern system.

Runnable examples

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

random-walk-melody

Pbind(\degree, Pbrown(0, 7, 1, inf), \dur, 0.25).play

supercollider-0027 · CC0

@n = (@n || 0) + [-1, 0, 1].choose; play (scale :e3, :minor)[@n % 8]; sleep 0.25

sonicpi-0019 · CC0

chord-roll

d1 $ rolledBy 0.25 $ n "c'maj7" # sound "superpiano"

tidal-0053 · CC0

pattern-sequencing

Pbind(\degree, Pseq([0, 2, 4, 7], inf), \dur, 0.25).play

supercollider-0023 · CC0

Atoms in this module

Required — these gate the capstone

Pbind maps keyword-value pairs into a timed stream of playable musical events
Concept L2 First instrument FNB
Pbind plays named SynthDefs via \instrument; SynthDef args become Pbind keys; freq and gate must be spelled exactly
Concept L2 First instrument FN
Pbind can drive any custom SynthDef by naming it with \instrument; SynthDef argument names become Pbind keys
Procedure L2 First instrument FB
Pbind specifies pitch four mutually exclusive ways: \degree, ote, \midinote, and req
Concept L2 First instrument FN
Chords in a Pbind are written as nested lists inside the pitch key
Concept L2 First instrument FN
Pbind supports named scales via \scale and chords via nested lists in pitch keywords
Procedure L2 First instrument F
Pbind rests are written as Rest(duration) and can appear in any parameter stream
Concept L2 First instrument FN
Pbind durations are in beats; a TempoClock sets BPM, defaulting to 60 BPM if none is provided
Concept L2 First instrument F
Pbind's stretch key converts rhythmic fractions to absolute seconds; quant locks changes to a grid
Concept L2 First instrument F
Calling .play on a Pbind returns an EventStreamPlayer, and only that stored player can be stopped or resumed
Concept L2 First instrument FN
SuperCollider Patterns are lazy descriptions of streams; asStream materialises them one value at a time
Concept L2 First instrument F
SuperCollider Patterns schedule streams of synthesis events algorithmically using Pbind and combinators
Concept L3 Craft F
The SC Pattern library includes Pser, Pxrand, Pshuf, Pslide, Pseries, Pgeom, and Pn for diverse sequence generation
Concept L2 First instrument FN
Pseq plays items from a list in order for a given number of repetitions
Concept L2 First instrument F
Prand picks a random item from a list on each event, constrained to list members
Concept L2 First instrument F
Pwhite generates uniformly-distributed random numbers across a continuous range
Concept L2 First instrument F
Pseq, Prand, and Pwhite are three core Pattern generators with distinct selection behaviors
Concept L2 First instrument FN
A SuperCollider pattern is a factory for a stream, with Pseq and Prand giving ordered and random values
Concept L3 Craft F
Pchain and Ppar compose event patterns by layering key sources or running multiple patterns in parallel
Concept L3 Craft F
Pbindef modifies individual keys of a running Pbind without restarting the stream
Concept L3 Craft F
Pdefn holds a named pattern value that can be derived and reused across multiple running streams in SuperCollider
Concept L3 Craft F
SuperCollider Routines and Tasks are coroutines that yield time to the clock between musical events
Concept L2 First instrument F
TempoClock schedules functions in beats, re-running them whenever they return a number
Concept L2 First instrument F
fork schedules time-ordered Pbind launches using .wait calls inside a Routine running on a TempoClock
Procedure L2 First instrument F

Supporting — enrichment, not gating

Pbrown implements a bounded random walk that moves musical parameters in small steps
Concept L2 First instrument FA
SuperCollider's Pbind pattern system is comprehensive but hard to read and manipulate live, motivating constrained live-coding languages
Concept L3 Craft FN
SuperCollider methods do not auto-return their last expression; the caret (^) designates the return value
Concept L3 Craft F
SuperCollider classes and events both support object modeling: classes via inheritance, events via prototype chains
Concept L3 Craft F
Pfunc generates pattern values by calling a function, and Pkey cross-references values from an earlier key
Concept L3 Craft F
Wrapping array indexes with wrapAt lets SC sequences cycle through parameter arrays of different lengths
Concept L2 First instrument F
SuperCollider's Event system dispatches sound by type, making note, rest, group, and bus events uniform
Concept L2 First instrument F