playgrid.ccRead tutorial

Tutorial 006 / SuperCollider

Build Detuned Room Pad in SuperCollider

Build Detuned Room Pad in SuperCollider with detuned saw pad, explicit envelopes and the sound-shaping chain explained in the guide.

4 stepsDetuned Saw 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 / 4

Blend the slowly beating saws

Select ~soundStage = 1 and evaluate the full script at the end of this guide. Wait for the instrument-ready message before playing.

Set ~soundStage = 1 in the full script. Mix three saws at frequency ratios 1, 1.001 and 1.008 with gains −6, −10 and −6.7 dB. Use 885 ms attack, full sustain and 3 s release at −9 dB instrument gain. The explicit ratio offsets interpret Operator Fine values, which are not cents. Velocity does not alter this source.

SuperCollider control Value
Ratios 1 / 1.001 / 1.008
Levels −6 / −10 / −6.7 dB
Amplitude 885 ms attack; full sustain; 3 s release
Instrument −9 dB

Sound after step 1 — WebM/Opus

Next: Open a gentle tracked filter →

Step 02 / 4

Open a gentle tracked filter

Set ~soundStage = 2 in the full script. Use a 2800 Hz ladder lowpass with 0.01 resonance and full pitch tracking. Its contour rises in 92 ms, decays over 4.3 s to 0.72 and releases over 3 s. A chosen 0.9-octave depth interprets the source 15% amount. The filter opens before the slower amplitude peak, then settles into a softer sustained spectrum.

SuperCollider control Value
Cutoff / resonance 2800 Hz base / 0.01
Contour 92 ms / 4.3 s / 0.72 / 3 s
Envelope / tracking 0.9 octaves / 1 octave per octave

For MoogFF, multiply the stated source resonance amount by four to obtain its 0–4 gain argument (limited to 3.95). The complete script gives this gain expression beside each cutoff.

Sound after step 2 — WebM/Opus

Next: Add moving stereo chorus →

Step 03 / 4

Add moving stereo chorus

Set ~soundStage = 3 in the full script. Move two delay taps around 15 ms by ±9 ms at 0.6 Hz, with opposite phases and 52% wet mix. The wet inputs remain full-band. Scale side information by 1; tap feedback is 0. These explicit tap depths interpret the source Amount and ensemble movement rather than copy the internal algorithm. Sustained notes reveal slow pitch interference.

SuperCollider control Value
Tap center / excursion 15 / ±9 ms
Rate / wet 0.6 Hz / 52%
Wet highpass Off
Width / feedback 1 / 0
Warmth shaping 0% smooth-drive interpretation

Sound after step 3 — WebM/Opus

Next: Surround the tone with a damped room →

Step 04 / 4

Surround the tone with a damped room

Set ~soundStage = 4 and evaluate the full block. Feed the preceding signal into FreeVerb2, using its fully wet output and the dry/wet routing shown in the script. The room continues after individual note envelopes release. Predelay separates the initial articulation from the diffuse tail; the external wet mix controls how far that tail moves forward.

The SuperCollider room value is 0.782951 and damping is 0.71875. These dimensionless settings are choices for this algorithm, rather than equivalent values for Ableton decay or Csound feedback and damping. More damping darkens the circulating highs. Any input filters and mid/side width changes in this stage retain their own explicit settings in the full script.

SuperCollider room control Value
FreeVerb2 internal mix 1, wet output only
Room 0.782951
Damping 0.71875
Predelay 8 ms
External room wet 50%
SuperCollider control Value
Room side multiplier 1
Room input cuts Off

Sound after step 4 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full SuperCollider script

The complete Detuned Room Pad instrument uses stock SuperCollider units. Set ~soundStage from 1 to 4 and evaluate the entire block again to select a cumulative stage. Wait for the ready message; ~soundNote.(60, 0.8, 1) plays MIDI 60 at velocity 0.8 with a one-second held duration. Held duration controls when release begins, while each source's decay and modulation continue independently. ~soundStop.() frees the active instrument and its effects. This block replaces the previously installed PlayGrid instrument in the same interpreter.

(
~soundStage = 4;
~soundOutputScale = 1.162154;
~soundRelease = 3;
~soundNames = (motion: \pgDetunedRoomPadMotion, voice: \pgDetunedRoomPadVoice, effects: \pgDetunedRoomPadEffects);

~soundDefs = [
    SynthDef(\pgDetunedRoomPadMotion, { |out=0| Out.kr(out, DC.kr(0)) }),
    SynthDef(\pgDetunedRoomPadVoice, { |out=0, midi=60, velocity=0.8, gate=1, startMidi=60|
        var stage = ~soundStage;
    var aA = 0, aB = 0, aC = 0, aL = 0, aR = 0, aSource = 0, iHz = 0, iVelocity = 0;
    var kAmp = 0, kCut = 0, kFilter = 0;
    iHz = (midi).midicps;
    iVelocity = (velocity).clip(0, 1);
    aA = (Saw.ar((iHz * 1)) * ((0 - 6)).dbamp);
    aB = (Saw.ar((iHz * 1.001)) * ((0 - 10)).dbamp);
    aC = (Saw.ar((iHz * 1.008)) * ((0 - 6.7)).dbamp);
    aSource = ((aA + aB) + aC);
    if((stage >= 2)) {
    kFilter = EnvGen.kr(Env([0, 1, 0.72, 0], [0.092, 4.3, 3], \lin, releaseNode: 2), gate);
    kCut = ((2800 * (2 ** ((0.9 * kFilter) + ((midi - 60) / 12))))).clip(30, 18000);
    aSource = MoogFF.ar(aSource, (kCut).clip(20, 18000), (0.01 * 4).clip(0, 3.95));
    };
    kAmp = EnvGen.kr(Env([0, 1, 1, 0], [0.885, 1.21, 3], \lin, releaseNode: 2), gate);
    aL = ((aSource * kAmp) * ((0 - 9)).dbamp);
    aR = aL;
    Out.ar(out, [aL, aR]);
        EnvGen.kr(Env.asr(0.0001, 1, 3), gate, doneAction: 2);
    }),
    SynthDef(\pgDetunedRoomPadEffects, { |in=0, out=0|
        var stage = ~soundStage;
        var outputScale = ~soundOutputScale;
        var input = In.ar(in, 2);
    var feedback = LocalIn.ar(2);
    var aChFbL = 0, aChFbR = 0, aChInL = 0, aChInR = 0, aChMid = 0, aChSide = 0, aChTimeL = 0, aChTimeR = 0;
    var aL = 0, aR = 0, aRoomInL = 0, aRoomInR = 0, aRoomL = 0, aRoomMid = 0, aRoomPreL = 0, aRoomPreR = 0;
    var aRoomR = 0, aRoomSide = 0, aTapL = 0, aTapR = 0, kCh = 0, room26 = 0;
    aL = input[0];
    aR = input[1];
    if((stage >= 3)) {
    aChFbL = feedback[0];
    aChFbR = feedback[1];
    aChInL = aL;
    aChInR = aR;
    kCh = (SinOsc.kr(0.6, 0 * 2pi) * 1);
    aChTimeL = K2A.ar((15 + (9.0 * kCh)));
    aChTimeR = K2A.ar((15 - (9.0 * kCh)));
    aTapL = DelayC.ar((aChInL + (aChFbL * 0)), 80 / 1000, (aChTimeL / 1000).clip(0.00002, 80 / 1000));
    aTapR = DelayC.ar((aChInR + (aChFbR * 0)), 80 / 1000, (aChTimeR / 1000).clip(0.00002, 80 / 1000));
    aChFbL = aTapL;
    aChFbR = aTapR;
    aL = ((aL * 0.48) + (aTapL * 0.52));
    aR = ((aR * 0.48) + (aTapR * 0.52));
    aChMid = ((aL + aR) * 0.5);
    aChSide = (((aL - aR) * 0.5) * 1);
    aL = (aChMid + aChSide);
    aR = (aChMid - aChSide);
    };
    if((stage >= 4)) {
    aRoomInL = aL;
    aRoomPreL = DelayN.ar(aRoomInL, 0.008, 0.008);
    aRoomInR = aR;
    aRoomPreR = DelayN.ar(aRoomInR, 0.008, 0.008);
    room26 = FreeVerb2.ar(aRoomPreL, aRoomPreR, 1, 0.782951, 0.71875);
    aRoomL = room26[0];
    aRoomR = room26[1];
    aRoomMid = ((aRoomL + aRoomR) * 0.5);
    aRoomSide = (((aRoomL - aRoomR) * 0.5) * 1);
    aL = ((aL * 0.5) + ((aRoomMid + aRoomSide) * 0.5));
    aR = ((aR * 0.5) + ((aRoomMid - aRoomSide) * 0.5));
    };
    LocalOut.ar([aChFbL, aChFbR].collect { |channel| channel + DC.ar(0) });
    Out.ar(out, [((aL * 1) * outputScale), ((aR * 1) * outputScale)]);
    })
];
~soundStop = {
    if(~cirrusGroup.notNil) { ~cirrusGroup.free; ~cirrusGroup = nil };
    if(~cirrusAudio.notNil) { ~cirrusAudio.free; ~cirrusAudio = nil };
    if(~cirrusMotion.notNil) { ~cirrusMotion.free; ~cirrusMotion = nil };
    if(~pgGroup.notNil) { ~pgGroup.free; ~pgGroup = nil };
    if(~pgAudio.notNil) { ~pgAudio.free; ~pgAudio = nil };
    if(~pgMotion.notNil) { ~pgMotion.free; ~pgMotion = nil };
};
~soundInstall = {
    s.waitForBoot {
        ~soundStop.();
        ~soundDefs.do { |definition| definition.add };
        s.sync;
        ~pgAudio = Bus.audio(s, 2);
        ~pgMotion = Bus.control(s, 1);
        ~pgGroup = Group.head(s);
        ~pgLastMidi = 60;
        Synth.head(~pgGroup, ~soundNames.motion, [\out, ~pgMotion]);
        ~pgVoices = Group.tail(~pgGroup);
        Synth.tail(~pgGroup, ~soundNames.effects, [\in, ~pgAudio]);
        "Detuned Room Pad ready".postln;
    };
};
~soundNote = { |midi=60, velocity=0.8, hold=1|
    var note = Synth.head(~pgVoices, ~soundNames.voice, [
        \out, ~pgAudio, \midi, midi, \velocity, velocity.clip(0, 1),
        \startMidi, ~pgLastMidi
    ]);
    ~pgLastMidi = midi;
    SystemClock.sched(hold, { note.set(\gate, 0); nil });
    note;
};
if(~soundOffline != true) { ~soundInstall.() };
)