GENERATIVE MUSIC · AUDIO DSP · CHUCK_

WEEFSEL — generative music in ChucK

A small album that composes itself. Six algorithmic études written in ChucK, a strongly-timed audio language — no samples and no DAW, every sound synthesised from oscillators and filters and every note chosen at run time by stochastic processes, Markov chains and self-mutating patterns. The piece is then rendered offline to audio, while ChucK emits each note it plays so the browser loom below can weave the exact same events in lock-step with the sound. Weefsel is Afrikaans for “weave”.

ChucK 1.5 Strongly-timed Generative STK synthesis Offline render Canvas visualiser JS interpreter Web Audio Zero samples
~/weefsel $ ./play --loom
Pick a track, hit , and watch the loom weave the notes. Open the player fullscreen ↗

The six pieces play right here. The picture is not an audio analysis — it's a replay of the actual note events the ChucK program emitted at render time: pitch rises upward, each instrument is a colour, and notes flare as they cross the bright now-line. Audio streams as MP3; the visuals run from a small baked-in event file, so the only thing the browser needs is to play sound. Best with the volume up.

WEEFSEL title over a loom of coloured note events scattered across a dark canvas with a glowing vertical now-line

Bonus: run ChucK live in the browser

The album is rendered offline by real ChucK — but to show how the language itself works, I also wrote a simulated ChucK runtime in pure JavaScript: a from-scratch lexer, parser and tree-walking interpreter for a subset of ChucK, synthesising live on the Web Audio API. It's not the real VM — it exists to demo ChucK's two signature ideas in a page you can edit:

Pick an example, edit the code, hit ▶ run (or Ctrl/⌘+↵) and watch the oscilloscope. Open the runtime fullscreen ↗

Six editable demos ship with it — a strongly-timed sine, a pentatonic arpeggiator, a sporked chord pad, a Poisson rain, a self-rewriting drum machine, and a miniature of dagbreek. A lookahead scheduler keeps audio in sync and a runaway guard catches a while(true) with no => now. The interpreter is audio-agnostic, so its whole language core is unit-tested head-less under Node.

Overview

WEEFSEL is built the way ChucK is meant to be used: time is a value. A line like 4500::ms => now advances the piece by four and a half seconds, so rhythm and musical form are expressed directly in the language rather than in a sequencer. On top of that sits a shared library — a Theory class that turns abstract scale degrees into pitches, and a set of polyphonic Voice classes (pad, bell, pluck, bass, drop, electric piano, kick, hat) that each build their own signal chain, play an envelope, then disconnect and free themselves. A piece just sporks notes and lets ChucK's scheduler overlap them.

Six études

🌅 dagbreek · daybreak

Slow pentatonic pads through a four-chord cycle while the register climbs and bells appear with rising probability — the music brightens like a sunrise.

🌧️ reën · rain

A shower modelled as a Poisson point process: droplets arrive with exponentially-distributed gaps whose rate swells and recedes like a passing squall.

🌊 onderstroom · undertow

A slow minor groove — walking bass and a Rhodey electric piano over a pad — whose chords follow a Markov chain that wanders but always resolves home.

⚙️ masjien · machine

A 16-step clock drives kick, hat and a bass ostinato while a probability-masked lead improvises and the patterns mutate every few bars — a drum machine that re-writes itself.

🌆 skemer · dusk

Sparse lydian bells and soft piano over a thinning drone, with note density decaying toward silence as the light goes and the reverb gets the last word.

🌙 maanlig · moonlight

The closer: a nocturne whose melody is a 1/f fractal (Voss–McCartney) — self-similar pink-noise motion that wanders with both small wiggles and slow arcs, a single Rhodey line under bells with a sub-bass anchoring the low dips.

🪡 the loom

A Scribe taps every note to a CSV at render time; the page replays those events on a canvas in sync with the MP3, so what you see is what the algorithm played.

How it works

It also runs live — chuck lib/*.ck pieces/04-masjien.ck plays a piece in real time. Open the player →