playgrid.ccRead tutorial

Tutorial 003 / SuperCollider

Build Slow Harmonic Pad in SuperCollider

Build Slow Harmonic Pad in SuperCollider with drawn harmonics, explicit envelopes and the sound-shaping chain explained in the guide.

3 stepsDrawn HarmonicsSuperCollider

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 / 3

Draw the high ringing center

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. Use the three-partial A table at ratio 9 and global transposition −14 semitones. Its partials have levels 0, −2.3 and −10.5 dB. A opens over 2.057 seconds and releases over 4.3 seconds. The high ratio supplies the ringing center; table amplitudes remain unnormalized.

SuperCollider control Value
A partials 1: 0 dB; 2: −2.3 dB; 3: −10.5 dB
A ratio / transpose 9 / −14 st
A envelope 2.057 s attack; full sustain; 4.3 s release
Instrument −33 dB

Sound after step 1 — WebM/Opus

Next: Fill in the lower harmonic spectra →

Step 02 / 3

Fill in the lower harmonic spectra

Set ~soundStage = 2 in the full script. Add the documented B and C spectra through partial 38, with different attacks and a B frequency ratio of 1.003. Add D with its quiet low odd harmonics. The exact partial coefficients are written in the full script. Their different onset and release times make the texture change as it grows and fades; B fine tuning is an explicit ratio interpretation.

SuperCollider control Value
B −1.9 dB; 2.294 s attack; 3.7 s release; ratio 1.003
C −9.1 dB; 2.8 s attack; 4.1 s release; ratio 1
D −6 dB; 2.38 s attack; 4 s release; ratio 1
Tables Unnormalized sine sums; unlisted partials zero

Sound after step 2 — WebM/Opus

Next: Add moving stereo chorus →

Step 03 / 3

Add moving stereo chorus

Set ~soundStage = 3 in the full script. Also apply source amplitude movement 0.82 + 0.18 × sine(0.35 Hz). The explicit 0.35 Hz rate interprets the source displayed LFO rate 35. Move two delay taps around 7 ms by ±3.4 ms at 0.9 Hz, with opposite phases and 100% wet mix. The wet inputs remain full-band. Scale side information by 1.3; tap feedback is -0.02. 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 7 / ±3.4 ms
Rate / wet 0.9 Hz / 100%
Wet highpass Off
Width / feedback 1.3 / -0.02
Warmth shaping 0% smooth-drive interpretation
Source amplitude LFO 0.35 Hz; multiplier 0.82 + 0.18 × sine

Sound after step 3 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full SuperCollider script

The complete Slow Harmonic Pad instrument uses stock SuperCollider units. Set ~soundStage from 1 to 3 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 = 3;
~soundOutputScale = 1.133972;
~soundRelease = 4.3;
~soundNames = (motion: \pgSlowHarmonicPadMotion, voice: \pgSlowHarmonicPadVoice, effects: \pgSlowHarmonicPadEffects);
~pgWave = { |freq, amplitude=1, phase=0, partials=#[1]|
    Mix(partials.collect { |weight, i|
        var harmonic = freq * (i + 1);
        SinOsc.ar(harmonic.clip(0.01, 22000), phase * 2pi * (i + 1)) * weight * (harmonic < 22000)
    }) * amplitude;
};
~soundDefs = [
    SynthDef(\pgSlowHarmonicPadMotion, { |out=0| Out.kr(out, DC.kr(0)) }),
    SynthDef(\pgSlowHarmonicPadVoice, { |out=0, midi=60, velocity=0.8, gate=1, startMidi=60|
        var stage = ~soundStage;
    var aA = 0, aB = 0, aC = 0, aD = 0, aL = 0, aR = 0, aSource = 0, iHz = 0;
    var iVelocity = 0, kA = 0, kB = 0, kC = 0, kD = 0, kHz = 0, kTrem = 0;
    iHz = (midi).midicps;
    iVelocity = (velocity).clip(0, 1);
    kHz = (iHz * (2 ** ((0 - 14) / 12)));
    kA = EnvGen.kr(Env([0, 1, 1, 0], [2.057, 0.5, 4.3], \lin, releaseNode: 2), gate);
    aA = ~pgWave.((kHz * 9), kA, 0, [1, 0.767361489, 0.298538262, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
    aSource = (aA * (0.6 + (0.4 * iVelocity)));
    if((stage >= 2)) {
    kB = EnvGen.kr(Env([0, 1, 1, 0], [2.294, 0.5, 3.7], \lin, releaseNode: 2), gate);
    aB = ~pgWave.((kHz * 1.003), (kB * ((0 - 1.9)).dbamp), 0, [0, 0.0462381021, 0, 0.0518800039, 0, 0.0446683592, 0, 0.0298538262, 0, 0.0812830516, 0.199526231, 0.167880402, 0.221309471, 0.201836636, 0.136458314, 0.103514217, 0.0776247117, 0, 0.192752491, 0.266072506, 0.221309471, 0.216271852, 0.171790839, 0.0699841996, 0.0575439937, 0.0891250938, 0, 0.147910839, 0.28840315, 0.0812830516, 0.221309471, 0.0323593657, 0.0758577575, 0.034673685, 0.181970086, 0.0416869383, 0.167880402, 0.0653130553]);
    aSource = (aSource + (aB * (1 + (0 * iVelocity))));
    kC = EnvGen.kr(Env([0, 1, 1, 0], [2.8, 0.5, 4.1], \lin, releaseNode: 2), gate);
    aC = ~pgWave.((kHz * 1), (kC * ((0 - 9.1)).dbamp), 0, [0, 0.0462381021, 0, 0.0518800039, 0, 0.0446683592, 0, 0.0298538262, 0, 0.0812830516, 0.199526231, 0.167880402, 0.221309471, 0.201836636, 0.136458314, 0.103514217, 0.0776247117, 0, 0.192752491, 0.266072506, 0.221309471, 0.216271852, 0.171790839, 0.0699841996, 0.0575439937, 0.0891250938, 0, 0.147910839, 0.28840315, 0.0812830516, 0.221309471, 0.0323593657, 0.0758577575, 0.034673685, 0.181970086, 0.0416869383, 0.167880402, 0.0653130553]);
    aSource = (aSource + (aC * (1 + (0 * iVelocity))));
    kD = EnvGen.kr(Env([0, 1, 1, 0], [2.38, 0.5, 4], \lin, releaseNode: 2), gate);
    aD = ~pgWave.((kHz * 1), (kD * ((0 - 6)).dbamp), 0, [0.120226443, 0, 0.24266101, 0, 0.254097271, 0, 0.144543977, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
    aSource = (aSource + (aD * (0.65 + (0.35 * iVelocity))));
    };
    if((stage >= 3)) {
    kTrem = (SinOsc.kr(0.35, 0 * 2pi) * 1);
    aSource = (aSource * (0.82 + (0.18 * kTrem)));
    };
    aL = (aSource * ((0 - 33)).dbamp);
    aR = aL;
    Out.ar(out, [aL, aR]);
        EnvGen.kr(Env.asr(0.0001, 1, 4.3), gate, doneAction: 2);
    }),
    SynthDef(\pgSlowHarmonicPadEffects, { |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, aTapL = 0, aTapR = 0, kCh = 0;
    aL = input[0];
    aR = input[1];
    if((stage >= 3)) {
    aChFbL = feedback[0];
    aChFbR = feedback[1];
    aChInL = aL;
    aChInR = aR;
    kCh = (SinOsc.kr(0.9, 0 * 2pi) * 1);
    aChTimeL = K2A.ar((7 + (3.4000000000000004 * kCh)));
    aChTimeR = K2A.ar((7 - (3.4000000000000004 * kCh)));
    aTapL = DelayC.ar((aChInL + (aChFbL * (0 - 0.02))), 80 / 1000, (aChTimeL / 1000).clip(0.00002, 80 / 1000));
    aTapR = DelayC.ar((aChInR + (aChFbR * (0 - 0.02))), 80 / 1000, (aChTimeR / 1000).clip(0.00002, 80 / 1000));
    aChFbL = aTapL;
    aChFbR = aTapR;
    aL = ((aL * 0) + (aTapL * 1));
    aR = ((aR * 0) + (aTapR * 1));
    aChMid = ((aL + aR) * 0.5);
    aChSide = (((aL - aR) * 0.5) * 1.3);
    aL = (aChMid + aChSide);
    aR = (aChMid - aChSide);
    };
    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]);
        "Slow Harmonic 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.() };
)