playgrid.ccRead tutorial

Tutorial 001 / SuperCollider

Build Falling Spectral Lead in SuperCollider

Build Falling Spectral Lead in SuperCollider with harmonic lead, explicit envelopes and the sound-shaping chain explained in the guide.

9 stepsHarmonic LeadSuperCollider

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

Begin with the plain sine

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. Start from a sine carrier, a near-instant opening, full sustain and 400 ms release. Use −18 dB source gain and no filter, pitch movement or effects. The initial source isolates the fundamental before its harmonic layers are added.

SuperCollider control Value
Carrier / gain Sine, ratio 1 / −18 dB
Amplitude 0.1 ms attack; full sustain; 400 ms release

Sound after step 1 — WebM/Opus

Next: Build the parallel harmonic layers →

Step 02 / 9

Build the parallel harmonic layers

Set ~soundStage = 2 in the full script. Mix four independent sources. Truncated saw tables retain four, three and eight partials rather than using FM; the sine at ratio 4 reinforces the high even body. The sine sums use unnormalized 1/n coefficients. This keeps the harmonic construction explicit.

SuperCollider control Value
A Ratio 2; four-partial saw; −5 dB
B Ratio 4; sine; −1 dB
C Ratio 3; three-partial saw; −7 dB
D Ratio 1; eight-partial saw; −18 dB

Sound after step 2 — WebM/Opus

Next: Give every layer the same swell →

Step 03 / 9

Give every layer the same swell

Set ~soundStage = 3 in the full script. Use a 145 ms attack, 1.10 s decay to −10 dB and 350 ms release. A shared linear contour represents the four matching source envelopes. Short notes release before the body develops; held notes settle into a quieter sustain.

SuperCollider control Value
Amplitude A/D/S/R 145 ms / 1.10 s / −10 dB / 350 ms

Sound after step 3 — WebM/Opus

Next: Add the falling pitch contour →

Step 04 / 9

Add the falling pitch contour

Set ~soundStage = 4 in the full script. Start two semitones above each note and fall to its pitch over 1.10 seconds. A note-off release of 899 ms brings any remaining offset to zero. Every harmonic follows the same moving fundamental.

SuperCollider control Value
Pitch +2 → 0 semitones in 1.10 s
Pitch release 899 ms

Sound after step 4 — WebM/Opus

Next: Soften the spectrum and raise instrument gain →

Step 05 / 9

Soften the spectrum and raise instrument gain

Set ~soundStage = 5 in the full script. Use a 6200 Hz ladder lowpass with zero resonance, then set instrument gain to +2.5 dB. This interprets the source Clean 24 dB filter. Operator Tone and its small global spread are not separate controls here; chorus supplies the later stereo movement.

SuperCollider control Value
Lowpass 6200 Hz, resonance 0
Instrument gain +2.5 dB

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 5 — WebM/Opus

Next: Add moving stereo chorus →

Step 06 / 9

Add moving stereo chorus

Set ~soundStage = 6 in the full script. Move two delay taps around 15 ms by ±4.4 ms at 0.65 Hz, with opposite phases and 20% 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 / ±4.4 ms
Rate / wet 0.65 Hz / 20%
Wet highpass Off
Width / feedback 1 / 0
Warmth shaping 0% smooth-drive interpretation

Sound after step 6 — WebM/Opus

Next: Add full-band stereo echoes →

Step 07 / 9

Add full-band stereo echoes

Set ~soundStage = 7 in the full script. Use 939 ms left and 939 ms right, 32% feedback and 22% wet. Inject the centered input on the left and cross-feed the filtered echoes so later repeats alternate sides. Keep repeats full-band. Feedback values are updated once per server processing block, adding that small delay to the recirculating path. Held notes leave older colors behind the current tone.

SuperCollider control Value
Times 939 / 939 ms
Feedback / wet 32% / 22%
Routing Crossed, left input
Filter center / width Off
Time LFO 0 Hz, ±0%

Sound after step 7 — WebM/Opus

Next: Surround the tone with a damped room →

Step 08 / 9

Surround the tone with a damped room

Set ~soundStage = 8 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.935902 and damping is 0.625. 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.935902
Damping 0.625
Predelay 12 ms
External room wet 68%
SuperCollider control Value
Room side multiplier 1
Room input cuts Off

Sound after step 8 — WebM/Opus

Next: Set the final width and gain →

Step 09 / 9

Set the final width and gain

Set ~soundStage = 9 in the full script. Use 0.5 dB gain after the effects. Scale the side signal by 0.85, preserving the center. Leave final DC removal off. The fixed ~soundOutputScale gain follows the complete effect chain at every stage. The effects Synth reads the stereo bus after the note group, and continues through note releases.

SuperCollider control Value
Final gain 0.5 dB
Width 0.85 × side
Bass side cutoff Off
DC removal Off

Sound after step 9 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full SuperCollider script

The complete Falling Spectral Lead instrument uses stock SuperCollider units. Set ~soundStage from 1 to 9 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 = 9;
~soundOutputScale = 0.05327541;
~soundRelease = 0.899;
~soundNames = (motion: \pgFallingSpectralLeadMotion, voice: \pgFallingSpectralLeadVoice, effects: \pgFallingSpectralLeadEffects);
~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(\pgFallingSpectralLeadMotion, { |out=0| Out.kr(out, DC.kr(0)) }),
    SynthDef(\pgFallingSpectralLeadVoice, { |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, kAmp = 0, kFinal = 0, kGain = 0, kHz = 0, kPitch = 0;
    iHz = (midi).midicps;
    iVelocity = (velocity).clip(0, 1);
    kPitch = 0;
    if((stage >= 4)) {
    kPitch = EnvGen.kr(Env([2, 0, 0], [1.10, 0.899], \lin, releaseNode: 1), gate);
    };
    kHz = (iHz * (2 ** (kPitch / 12)));
    aSource = (SinOsc.ar(kHz, 0 * 2pi) * 1);
    if((stage >= 2)) {
    aA = ~pgWave.((kHz * 2), ((0 - 5)).dbamp, 0, [1.0, 0.5, 0.3333333333333333, 0.25]);
    aB = (SinOsc.ar((kHz * 4), 0 * 2pi) * ((0 - 1)).dbamp);
    aC = ~pgWave.((kHz * 3), ((0 - 7)).dbamp, 0, [1.0, 0.5, 0.3333333333333333]);
    aD = ~pgWave.(kHz, ((0 - 18)).dbamp, 0, [1.0, 0.5, 0.3333333333333333, 0.25, 0.2, 0.16666666666666666, 0.14285714285714285, 0.125]);
    aSource = (((aA + aB) + aC) + aD);
    };
    kAmp = EnvGen.kr(Env([0, 1, 1, 0], [0.0001, 1, 0.4], \lin, releaseNode: 2), gate);
    if((stage >= 3)) {
    kFinal = EnvGen.kr(Env([0, 1, ((0 - 10)).dbamp, 0], [0.145, 1.10, 0.350], \lin, releaseNode: 2), gate);
    kAmp = kFinal;
    };
    kGain = ((0 - 18)).dbamp;
    if((stage >= 5)) {
    aSource = MoogFF.ar(aSource, (6200).clip(20, 18000), (0 * 4).clip(0, 3.95));
    kGain = (2.5).dbamp;
    };
    aL = ((aSource * kAmp) * kGain);
    aR = aL;
    Out.ar(out, [aL, aR]);
        EnvGen.kr(Env.asr(0.0001, 1, 0.899), gate, doneAction: 2);
    }),
    SynthDef(\pgFallingSpectralLeadEffects, { |in=0, out=0|
        var stage = ~soundStage;
        var outputScale = ~soundOutputScale;
        var input = In.ar(in, 2);
    var feedback = LocalIn.ar(4);
    var aChFbL = 0, aChFbR = 0, aChInL = 0, aChInR = 0, aChMid = 0, aChSide = 0, aChTimeL = 0, aChTimeR = 0;
    var aDelFbL = 0, aDelFbR = 0, aDelSendL = 0, aDelSendR = 0, aDelTimeL = 0, aDelTimeR = 0, aEchoL = 0, aEchoR = 0;
    var aEndMid = 0, aEndSide = 0, aL = 0, aR = 0, aRoomInL = 0, aRoomInR = 0, aRoomL = 0, aRoomMid = 0;
    var aRoomPreL = 0, aRoomPreR = 0, aRoomR = 0, aRoomSide = 0, aTapL = 0, aTapR = 0, kCh = 0, kDelMotion = 0;
    var room41 = 0;
    aL = input[0];
    aR = input[1];
    if((stage >= 6)) {
    aChFbL = feedback[0];
    aChFbR = feedback[1];
    aChInL = aL;
    aChInR = aR;
    kCh = (SinOsc.kr(0.65, 0 * 2pi) * 1);
    aChTimeL = K2A.ar((15 + (4.4 * kCh)));
    aChTimeR = K2A.ar((15 - (4.4 * 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.8) + (aTapL * 0.2));
    aR = ((aR * 0.8) + (aTapR * 0.2));
    aChMid = ((aL + aR) * 0.5);
    aChSide = (((aL - aR) * 0.5) * 1);
    aL = (aChMid + aChSide);
    aR = (aChMid - aChSide);
    };
    if((stage >= 7)) {
    aDelFbL = feedback[2];
    aDelFbR = feedback[3];
    kDelMotion = 0;
    aDelTimeL = K2A.ar((939.0 * (1 + (0 * kDelMotion))));
    aDelTimeR = K2A.ar((939.0 * (1 - (0 * kDelMotion))));
    aDelSendL = ((aL + aR) * 0.5);
    aDelSendR = 0;
    aEchoL = DelayC.ar((aDelSendL + (aDelFbR * 0.32)), 2200 / 1000, (aDelTimeL / 1000).clip(0.00002, 2200 / 1000));
    aEchoR = DelayC.ar((aDelSendR + (aDelFbL * 0.32)), 2200 / 1000, (aDelTimeR / 1000).clip(0.00002, 2200 / 1000));
    aDelFbL = aEchoL;
    aDelFbR = aEchoR;
    aL = ((aL * 0.78) + (aEchoL * 0.22));
    aR = ((aR * 0.78) + (aEchoR * 0.22));
    };
    if((stage >= 8)) {
    aRoomInL = aL;
    aRoomPreL = DelayN.ar(aRoomInL, 0.012, 0.012);
    aRoomInR = aR;
    aRoomPreR = DelayN.ar(aRoomInR, 0.012, 0.012);
    room41 = FreeVerb2.ar(aRoomPreL, aRoomPreR, 1, 0.935902, 0.625);
    aRoomL = room41[0];
    aRoomR = room41[1];
    aRoomMid = ((aRoomL + aRoomR) * 0.5);
    aRoomSide = (((aRoomL - aRoomR) * 0.5) * 1);
    aL = ((aL * 0.31999999999999995) + ((aRoomMid + aRoomSide) * 0.68));
    aR = ((aR * 0.31999999999999995) + ((aRoomMid - aRoomSide) * 0.68));
    };
    if((stage >= 9)) {
    aEndMid = ((aL + aR) * 0.5);
    aEndSide = (((aL - aR) * 0.5) * 0.85);
    aL = ((aEndMid + aEndSide) * (0.5).dbamp);
    aR = ((aEndMid - aEndSide) * (0.5).dbamp);
    };
    LocalOut.ar([aChFbL, aChFbR, aDelFbL, aDelFbR].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]);
        "Falling Spectral Lead 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.() };
)