playgrid.ccRead tutorial

Tutorial 064 / SuperCollider

Build Indigo Arc in SuperCollider

Build Indigo Arc in SuperCollider with layered oscillators, explicit envelopes and the sound-shaping chain explained in the guide.

5 stepsLayered OscillatorsSuperCollider

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 the detuned source and amplitude contour

Select ~soundStage = 1 and evaluate the full script at the end of this guide. Wait for the instrument-ready message before playing. The triangle source is an explicit odd-harmonic sine sum through partial 31, with components at or above 22 kHz muted.

Set ~soundStage = 1 in the full script. Use 3 odd-partial triangle voices at -10 dB each, spread by 10.8 cents between adjacent voices. Reverse the stereo weights across the channels. The amplitude opens in 1.18 seconds, decays over 2.62 seconds to 0.794328, and releases over 3.04 seconds. Basic Shapes is represented by this explicit waveform; Shimmer, where present, becomes slow independent pitch drift rather than the original unison engine.

SuperCollider control Value
Sources 3 × triangle, -10 dB
Adjacent pitch spacing 10.8 cents
Amp A/D/S/R 1.18 s / 2.62 s / 0.794328 / 3.04 s
Instrument gain -9 dB
Velocity multiplier 0.4 + 0.6 × velocity

Sound after step 1 — WebM/Opus

Next: Blend the second source and animate the filters →

Step 02 / 5

Blend the second source and animate the filters

Set ~soundStage = 2 in the full script. Add a triangle layer at -20 dB, 7 semitones and 0 cents. Add the quieter octave-down sine sub. The lowpass center starts from 1610 Hz and moves by 0.9 octaves under the second envelope. A positive depth opens the spectral ceiling; a negative depth moves the notch downward. The serial second filter keeps the specified high or low edge under control. Exact wavetable morphing, Warp/Fold and free-running source modulation are not implemented; the code below defines the chosen static spectra and note-local drift.

SuperCollider control Value
Secondary layer triangle, -20 dB; 7 st; 0 cents
Filter 1 Lowpass, 1610 Hz base, 0.9 octave depth
Filter contour 2.2 / 3.3 / 0.65 / 3.5
Filter 2 Highpass at 95.0 Hz
Pulse width Not used

Sound after step 2 — WebM/Opus

Next: Add moving stereo chorus →

Step 03 / 5

Add moving stereo chorus

Set ~soundStage = 3 in the full script. Move two delay taps around 20 ms by ±4.6 ms at 0.38 Hz, with opposite phases and 24% wet mix. Highpass only the wet inputs at 200 Hz to leave the direct low body clear. Scale side information by 1.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 20 / ±4.6 ms
Rate / wet 0.38 Hz / 24%
Wet highpass 200 Hz
Width / feedback 1.1 / 0
Warmth shaping 12% smooth-drive interpretation

Sound after step 3 — WebM/Opus

Next: Surround the tone with a damped room →

Step 04 / 5

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.813934 and damping is 0.79375. 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.813934
Damping 0.79375
Predelay 25 ms
External room wet 28%
SuperCollider control Value
Room side multiplier 1
Room input cuts Off

Sound after step 4 — WebM/Opus

Next: Set the final width and gain →

Step 05 / 5

Set the final width and gain

Set ~soundStage = 5 in the full script. Use 3.44 dB gain after the effects. Scale the side signal by 1.05, preserving the center. Highpass only the side at 180 Hz to focus the lowest frequencies. Apply LeakDC DC removal with coefficient 0.995. 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 3.44 dB
Width 1.05 × side
Bass side cutoff 180 Hz
DC removal LeakDC, coefficient 0.995

Sound after step 5 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full SuperCollider script

The complete Indigo Arc instrument uses stock SuperCollider units. Set ~soundStage from 1 to 5 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 = 5;
~soundOutputScale = 1.48384;
~soundRelease = 3.5;
~soundNames = (motion: \pgIndigoArcMotion, voice: \pgIndigoArcVoice, effects: \pgIndigoArcEffects);
~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;
};
~pgTriangle = { |freq, phase=0|
    var partials = Array.fill(31, { |i|
        var n = i + 1;
        if(n.odd) { ((-1) ** ((n - 1) / 2)) * 8 / (pi.squared * n.squared) } { 0 }
    });
    ~pgWave.(freq, 1, phase, partials);
};
~soundDefs = [
    SynthDef(\pgIndigoArcMotion, { |out=0| Out.kr(out, DC.kr(0)) }),
    SynthDef(\pgIndigoArcVoice, { |out=0, midi=60, velocity=0.8, gate=1, startMidi=60|
        var stage = ~soundStage;
    var aL = 0, aR = 0, aSub = 0, aV0 = 0, aV1 = 0, aV2 = 0, aW0 = 0, aW1 = 0;
    var aW2 = 0, iHz = 0, iVelocity = 0, kAmp = 0, kCut = 0, kFilter = 0, kGain = 0, kJ0 = 0;
    var kJ1 = 0, kJ2 = 0;
    iHz = (midi).midicps;
    iVelocity = (velocity).clip(0, 1);
    kJ0 = (SinOsc.kr(0.1, 0.0 * 2pi) * 1.44);
    aV0 = (~pgTriangle.((iHz * (2 ** (((0 - 10.799999999999999) + kJ0) / 1200))), 0.0) * ((0 - 10.0)).dbamp);
    if((stage >= 2)) {
    aW0 = (~pgTriangle.((iHz * (2 ** ((7.0 / 12) + ((0 - 10.799999999999999) / 1200)))), 0.0) * ((0 - 20.0)).dbamp);
    aV0 = (aV0 + aW0);
    };
    kJ1 = (SinOsc.kr(0.13, 0.3333333333333333 * 2pi) * 1.44);
    aV1 = (~pgTriangle.((iHz * (2 ** ((0.0 + kJ1) / 1200))), 0.3333333333333333) * ((0 - 10.0)).dbamp);
    if((stage >= 2)) {
    aW1 = (~pgTriangle.((iHz * (2 ** ((7.0 / 12) + (0.0 / 1200)))), 0.3333333333333333) * ((0 - 20.0)).dbamp);
    aV1 = (aV1 + aW1);
    };
    kJ2 = (SinOsc.kr(0.16, 0.6666666666666666 * 2pi) * 1.44);
    aV2 = (~pgTriangle.((iHz * (2 ** ((10.799999999999999 + kJ2) / 1200))), 0.6666666666666666) * ((0 - 10.0)).dbamp);
    if((stage >= 2)) {
    aW2 = (~pgTriangle.((iHz * (2 ** ((7.0 / 12) + (10.799999999999999 / 1200)))), 0.6666666666666666) * ((0 - 20.0)).dbamp);
    aV2 = (aV2 + aW2);
    };
    aL = ((((aV0 * 0.8) + (aV1 * 0.5)) + (aV2 * 0.20000000000000007)) / 1.5);
    aR = ((((aV0 * 0.2) + (aV1 * 0.5)) + (aV2 * 0.8)) / 1.5);
    if((stage >= 2)) {
    aSub = (SinOsc.ar((iHz * 0.5), 0 * 2pi) * ((0 - 20.0)).dbamp);
    aL = (aL + aSub);
    aR = (aR + aSub);
    };
    if((stage >= 2)) {
    kFilter = EnvGen.kr(Env([0, 1, 0.65, 0], [2.2, 3.3, 3.5], \lin, releaseNode: 2), gate);
    kCut = ((1610.0 * (2 ** ((0.9 * kFilter) + ((0.0 * (midi - 60)) / 12))))).clip(30, 18000);
    aL = RLPF.ar(aL, (kCut).clip(20, 18000), (1 / 1.12).clip(0.05, 2));
    aL = HPF.ar(aL, (95.0).clip(20, 18000));
    aR = RLPF.ar(aR, (kCut).clip(20, 18000), (1 / 1.12).clip(0.05, 2));
    aR = HPF.ar(aR, (95.0).clip(20, 18000));
    };
    kAmp = EnvGen.kr(Env([0, 1, 0.7943282347242815, 0], [1.18, 2.62, 3.04], \lin, releaseNode: 2), gate);
    kGain = ((kAmp * ((0 - 9.0)).dbamp) * (0.4 + (0.6 * iVelocity)));
    aL = (aL * kGain);
    aR = (aR * kGain);
    Out.ar(out, [aL, aR]);
        EnvGen.kr(Env.asr(0.0001, 1, 3.5), gate, doneAction: 2);
    }),
    SynthDef(\pgIndigoArcEffects, { |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 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, room28 = 0;
    aL = input[0];
    aR = input[1];
    if((stage >= 3)) {
    aChFbL = feedback[0];
    aChFbR = feedback[1];
    aChInL = HPF.ar(aL, (200.0).clip(20, 18000));
    aChInR = HPF.ar(aR, (200.0).clip(20, 18000));
    kCh = (SinOsc.kr(0.38, 0 * 2pi) * 1);
    aChTimeL = K2A.ar((20 + (4.6000000000000005 * kCh)));
    aChTimeR = K2A.ar((20 - (4.6000000000000005 * 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.76) + (aTapL * 0.24));
    aR = ((aR * 0.76) + (aTapR * 0.24));
    aChMid = ((aL + aR) * 0.5);
    aChSide = (((aL - aR) * 0.5) * 1.1);
    aL = (aChMid + aChSide);
    aR = (aChMid - aChSide);
    aL = (((aL * 1.12)).tanh / 1.12);
    aR = (((aR * 1.12)).tanh / 1.12);
    };
    if((stage >= 4)) {
    aRoomInL = aL;
    aRoomPreL = DelayN.ar(aRoomInL, 0.025, 0.025);
    aRoomInR = aR;
    aRoomPreR = DelayN.ar(aRoomInR, 0.025, 0.025);
    room28 = FreeVerb2.ar(aRoomPreL, aRoomPreR, 1, 0.813934, 0.79375);
    aRoomL = room28[0];
    aRoomR = room28[1];
    aRoomMid = ((aRoomL + aRoomR) * 0.5);
    aRoomSide = (((aRoomL - aRoomR) * 0.5) * 1);
    aL = ((aL * 0.72) + ((aRoomMid + aRoomSide) * 0.28));
    aR = ((aR * 0.72) + ((aRoomMid - aRoomSide) * 0.28));
    };
    if((stage >= 5)) {
    aEndMid = ((aL + aR) * 0.5);
    aEndSide = (((aL - aR) * 0.5) * 1.05);
    aEndSide = HPF.ar(aEndSide, (180.0).clip(20, 18000));
    aL = ((aEndMid + aEndSide) * (3.44).dbamp);
    aL = LeakDC.ar(aL, 0.995);
    aR = ((aEndMid - aEndSide) * (3.44).dbamp);
    aR = LeakDC.ar(aR, 0.995);
    };
    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]);
        "Indigo Arc 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.() };
)