playgrid.ccRead tutorial

Tutorial 032 / SuperCollider

Build Cirrus Window in SuperCollider

Build Cirrus Window in SuperCollider with detuned saw and pulse voices, moving serial filters, a three-tap ensemble and stereo reverb.

5 stepsOscillator PadSuperCollider

Listen to the finished sound

Download WEBM ↓

Follow the synthesis steps in order. Use the audio examples and device settings alongside the instructions.

Step 01 / 5

Build a slow, detuned saw body

Use ~soundStage = 1. The voice SynthDef makes three Saw oscillators at −7, 0 and +7 cents. Each has −13 dB gain and a slow ±2.2-cent sine drift. The outer voices drift at 0.226 Hz, while the center uses 0.17 Hz; their drift phases differ. Stereo weights of 0.87/0.5/0.13 put the outside voices toward opposite channels while sharing the center.

var amp = EnvGen.kr(Env([0, 1, -2.dbamp, 0], [0.85, 2.5, 2.4], \lin, 2), gate, doneAction: 2).pow(1.6);

The amplitude rises over 850 ms, decays toward −2 dB over 2.5 seconds, then holds until the gate closes. Release lasts 2.4 seconds. Raising the envelope to power 1.6 softens its middle levels and lowers its effective sustain to −3.2 dB. A short held note can release before either rise or decay finishes. Longer notes expose the slow beating.

Apply −8 dB instrument gain and a 0.65 multiplier before the shared effect bus. Velocity scales the result by 0.55 + 0.45 × velocity; it changes level without changing envelope times. One fixed 0.5 output multiplier applies to every stage.

Sound after step 1 — WebM/Opus

Next: Add moving pulses and serial filtering →

Step 02 / 5

Add moving pulses and serial filtering

Use ~soundStage = 2. Add one Pulse to each saw at −16 dB, tuned another +5 cents above that voice. A single cirrusMotion SynthDef supplies the shared 0.09 Hz sine motion. Each note reads its control bus so overlapping notes agree on pulse-width movement.

var width = 0.29 + (0.025 * In.kr(motionBus));
var cutoff = 850 * (2 ** ((0.8 * filterEnv) + (0.15 * (midi - 60) / 12)));
var filtered = LPF.ar(BPF.ar(stereo, cutoff, 1 / 0.85), 6200);

The pulse width travels between 0.265 and 0.315. filterEnv rises over 1.8 seconds, falls toward 0.6 over 3 seconds and releases over 2.4 seconds. At MIDI 60, the bandpass moves from 850 Hz to about 1480 Hz at the envelope peak. Its rq is bandwidth divided by center frequency, so 1 / 0.85 gives a broad band rather than a narrow whistle. Key tracking adds 0.15 octaves of cutoff per octave of played pitch. The following 6200 Hz lowpass softens the upper harmonics.

Sound after step 2 — WebM/Opus

Next: Thicken the stereo image with ensemble →

Step 03 / 5

Thicken the stereo image with ensemble

Use ~soundStage = 3. In cirrusEffects, highpass the ensemble input at 220 Hz. Feed three cubic-interpolated DelayC taps from the left channel, the mean of both channels and the right channel.

var times = 0.020 + (SinOsc.kr(0.24, [0, 2pi/3, 4pi/3]) * 0.0036);
var taps = DelayC.ar([hp[0], hp.sum * 0.5, hp[1]], 0.04, times);

Each tap moves between 16.4 and 23.6 ms at 0.24 Hz. The three phases are separated by one-third of a cycle. Blend 78% dry with 22% ensemble; each wet side uses 75% of its outside tap and 25% of the center tap. Then multiply the side component by 1.05. Increasing delay movement makes the pitch bending stronger; increasing the wet mix makes the moving image more prominent. This shared processor keeps overlapping voices in the same ensemble field.

Sound after step 3 — WebM/Opus

Next: Add a diffuse stereo room →

Step 04 / 5

Add a diffuse stereo room

Use ~soundStage = 4. Delay the room input by 28 ms and send it to the two-input FreeVerb2. Request its wet output, then blend that output with the unpredelayed ensemble.

var pre = DelayN.ar(signal, 0.028, 0.028);
var room = FreeVerb2.ar(pre[0], pre[1], 1, 0.84, 0.55);
var reverberated = (signal * 0.75) + (room * 0.25);

Room size is 0.84 and damping is 0.55. These dimensionless controls shape this algorithm's diffuse tail; room size 0.84 is not equivalent to Csound feedback 0.84, nor does damping 0.55 specify a 3300 Hz cutoff. The 25% wet blend retains the pad's moving center. More damping darkens the circulating high frequencies; a larger room value lengthens the lingering texture. The room remains active after the individual note Synths finish their releases.

Sound after step 4 — WebM/Opus

Next: Center the lows and finish the output →

Step 05 / 5

Center the lows and finish the output

Use ~soundStage = 5. Convert the reverberated stereo signal to mid and side, highpass only the side at 180 Hz, then reconstruct left and right. This reduces low-frequency spread while preserving motion above the cutoff.

var finalMid = mixed.sum * 0.5;
var finalSide = HPF.ar((mixed[0] - mixed[1]) * 0.5, 180);
var focused = LeakDC.ar([finalMid + finalSide, finalMid - finalSide]) * 10.9.dbamp;

LeakDC removes DC offset and the +10.9 dB gain restores level after the filtered effect chain. The additional fixed 0.5 output multiplier remains in place. LeakDC differs from the longer-window Csound dcblock2, particularly at very low frequencies. The result is a soft, slowly moving pad with a stable low center and a diffuse upper image.

Signal order matters: the motion source runs first, the voice group writes to a private stereo bus, and the effects Synth reads that bus afterward. The full script maintains that order so the same instrument can play overlapping notes.

Sound after step 5 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full SuperCollider script

Evaluate the complete block to define the instrument and its shared effects. ~soundStage selects the cumulative synthesis stage, from 1 to 5. ~soundNote.(60, 0.79, 2.5) produces a middle-C note with velocity 0.79 and a 2.5-second held duration. Longer notes reveal the slow filter opening and detuned beating. Wait for the instrument-ready message before playing; ~soundStop.() frees this instrument and its effects.

(
~soundStage = 5;
~soundNames = (motion: \cirrusMotion, voice: \cirrusVoice, effects: \cirrusEffects);
~soundDefs = [
    SynthDef(\cirrusMotion, { |out=0|
        // One free-running motion source shared by overlapping notes.
        Out.kr(out, SinOsc.kr(0.09));
    }),
    SynthDef(\cirrusVoice, { |out=0, motionBus=0, midi=60, velocity=0.79, gate=1, stage=5|
        var hz = midi.midicps;
        var amp = EnvGen.kr(Env([0, 1, -2.dbamp, 0], [0.85, 2.5, 2.4], \lin, 2), gate, doneAction: 2).pow(1.6);
        var filterEnv = EnvGen.kr(Env([0, 1, 0.6, 0], [1.8, 3, 2.4], \lin, 2), gate);
        var width = 0.29 + (0.025 * In.kr(motionBus));
        var cents = [-7, 0, 7];
        var phases = [0.08, 0.41, 0.73] * 2pi;
        var voices = cents.collect { |detune, i|
            var drift = SinOsc.kr(0.17 + (detune.abs * 0.008), phases[i]) * 2.2;
            var freq = hz * (2 ** ((detune + drift) / 1200));
            var saw = Saw.ar(freq) * -13.dbamp;
            var pulse = Pulse.ar(freq * (2 ** (5 / 1200)), width) * -16.dbamp;
            saw + (pulse * (stage >= 2));
        };
        var stereo = [
            ((voices[0] * 0.87) + (voices[1] * 0.5) + (voices[2] * 0.13)) / 1.5,
            ((voices[2] * 0.87) + (voices[1] * 0.5) + (voices[0] * 0.13)) / 1.5
        ];
        var cutoff = 850 * (2 ** ((0.8 * filterEnv) + (0.15 * (midi - 60) / 12)));
        var filtered = LPF.ar(BPF.ar(stereo, cutoff, 1 / 0.85), 6200);
        stereo = Select.ar(stage >= 2, [stereo, filtered]);
        Out.ar(out, stereo * amp * (0.55 + (0.45 * velocity.clip(0, 1))) * -8.dbamp * 0.65);
    }),
    SynthDef(\cirrusEffects, { |in=0, out=0, stage=5|
        var dry = In.ar(in, 2);
        var hp = HPF.ar(dry, 220);
        var times = 0.020 + (SinOsc.kr(0.24, [0, 2pi/3, 4pi/3]) * 0.0036);
        var taps = DelayC.ar([hp[0], hp.sum * 0.5, hp[1]], 0.04, times);
        var ensemble = (dry * 0.78) + ([
            (taps[0] * 0.75) + (taps[1] * 0.25),
            (taps[2] * 0.75) + (taps[1] * 0.25)
        ] * 0.22);
        var mid = ensemble.sum * 0.5;
        var side = (ensemble[0] - ensemble[1]) * 0.5 * 1.05;
        var widened = [mid + side, mid - side];
        var signal = Select.ar(stage >= 3, [dry, widened]);
        var pre = DelayN.ar(signal, 0.028, 0.028);
        // FreeVerb2's room/damp controls do not map to reverbsc or Ableton decay.
        var room = FreeVerb2.ar(pre[0], pre[1], 1, 0.84, 0.55);
        var reverberated = (signal * 0.75) + (room * 0.25);
        var mixed = Select.ar(stage >= 4, [signal, reverberated]);
        var finalMid = mixed.sum * 0.5;
        var finalSide = HPF.ar((mixed[0] - mixed[1]) * 0.5, 180);
        var focused = LeakDC.ar([finalMid + finalSide, finalMid - finalSide]) * 10.9.dbamp;
        // One fixed instrument gain applies to every stage.
        Out.ar(out, Select.ar(stage >= 5, [mixed, focused]) * 0.5);
    })
];
~soundStop = {
    if(~pgGroup.notNil) { ~pgGroup.free; ~pgGroup = nil };
    if(~pgAudio.notNil) { ~pgAudio.free; ~pgAudio = nil };
    if(~pgMotion.notNil) { ~pgMotion.free; ~pgMotion = nil };
    if(~cirrusGroup.notNil) { ~cirrusGroup.free; ~cirrusGroup = nil };
    if(~cirrusAudio.notNil) { ~cirrusAudio.free; ~cirrusAudio = nil };
    if(~cirrusMotion.notNil) { ~cirrusMotion.free; ~cirrusMotion = nil };
};
~soundInstall = {
    s.waitForBoot {
        ~soundStop.();
        ~soundDefs.do { |definition| definition.add };
        s.sync;
        ~cirrusAudio = Bus.audio(s, 2);
        ~cirrusMotion = Bus.control(s, 1);
        ~cirrusGroup = Group.head(s);
        Synth.head(~cirrusGroup, ~soundNames.motion, [\out, ~cirrusMotion]);
        ~cirrusVoices = Group.tail(~cirrusGroup);
        Synth.tail(~cirrusGroup, ~soundNames.effects, [\in, ~cirrusAudio, \stage, ~soundStage]);
        "Cirrus Window ready".postln;
    };
};
~soundNote = { |midi=60, velocity=0.79, hold=2.5|
    var note = Synth.head(~cirrusVoices, ~soundNames.voice, [
        \out, ~cirrusAudio, \motionBus, ~cirrusMotion, \midi, midi,
        \velocity, velocity, \stage, ~soundStage
    ]);
    SystemClock.sched(hold, { note.set(\gate, 0); nil });
    note;
};
// Offline authoring loads these same definitions without starting live audio.
if(~soundOffline != true) { ~soundInstall.() };
)