# Build Amber Crown in SuperCollider

A stock-unit SuperCollider interpretation of [the Ableton sound](/tutorials/amber-crown/) and its [Csound version](/tutorials/amber-crown/csound/). Each stage changes the source or its effect chain; oscillator, filter, modal and room algorithms differ across platforms.

[Starting settings](STARTING_STATE.md) · [Complete settings](ALL_PARAMETERS.md). The full runnable script ends this guide.

## Step 1 — Shape a drifting triangle cluster

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.

Use the `~pgSwarm` function and voice SynthDef from the full script with `~soundStage = 1`. Each voice is an odd-partial triangle from `~pgTriangle`. Mix five voices at −17.7, −8.85, 0, +8.85 and +17.7 cents; divide their sum by five so adding voices does not multiply the source level.


Each oscillator drifts by ±1.2 cents at a slightly different slow rate. Those rates and the fixed pitch spacing make sustained notes beat and change color. The triangle cluster is an interpretation of Swarm Triangle: its detuning and drift values are explicit SuperCollider choices, not a conversion of Meld's Motion and Spacing macros.

Set engine A's linear envelope to 473 ms attack, 2.43 s decay, −4 dB sustain and 2.26 s release. Apply −10 dB engine gain and −8 dB instrument gain, with velocity scaling `0.5 + 0.5 × velocity`. The mild `tanh(signal × 1.1) / 1.1` drive rounds peaks before instrument gain. At this stage both output channels carry the same cluster, so movement comes from beating rather than stereo spread.

<audio controls preload="none" aria-label="SuperCollider Amber Crown after step 1"><source src="audio/steps/step-01.webm" type="audio/webm"></audio>

[Sound after step 1 — WebM/Opus](audio/steps/step-01.webm)

## Step 2 — Add the slower octave bloom and stereo filtering

Set `~soundStage = 2`. Offset engine A by −3.125 cents and engine B by +3.125 cents, on top of B's octave-up tuning. These small opposing offsets interpret the source's spread behavior.

For the cluster, use left weights 0.8, 0.7, 0.5, 0.3 and 0.2, with reversed weights on the right. Divide each sum by 2.5. Apply `RLPF` at 2070 Hz with reciprocal Q 1 / 1.2 to each channel, then multiply A's right channel by 0.85 for a slight left bias. This resonance is a SuperCollider choice, not the numeric Meld Q value.


Engine B is a sine with 1.10 s attack, 4 s decay, −6 dB sustain and 2.20 s release, followed by a 3600 Hz lowpass. Its −22 dB gain makes the octave layer quieter than A. Panning B to 0.625 places it slightly right, opposite A's bias. Add both engines before the mild drive. Long notes reveal B arriving after A, while the filtered triangles retain a soft, beating body.

<audio controls preload="none" aria-label="SuperCollider Amber Crown after step 2"><source src="audio/steps/step-02.webm" type="audio/webm"></audio>

[Sound after step 2 — WebM/Opus](audio/steps/step-02.webm)

## Step 3 — Add moving, filtered cross-feedback echoes

Set `~soundStage = 3`. In the shared effects SynthDef, use delay times centered on 340 ms left and 470 ms right. A shared 0.18 Hz LFO moves them by ±2%, in opposite directions. `K2A` converts the control-rate delay-time signal to audio rate.


Filter both delayed outputs before assigning the feedback signals. Use a moving center `1700 × 2^(0.04 × LFO)` Hz, with a highpass at center / 2^1.5 and lowpass at center × 2^1.5. This interprets the source's delay filter as a three-octave passband. The filter motion is subtle; repeated echoes gradually lose lows and highs.

Cross-feed each filtered echo to the opposite delay at 30%, then mix 78% dry and 22% wet. The unequal paths and crossed repeats make the tail wander across the stereo field. The feedback assignment adds one control block to each feedback trip. This timing difference and the modulation scaling are SuperCollider-specific interpretations of the source's ping-pong delay.

<audio controls preload="none" aria-label="SuperCollider Amber Crown after step 3"><source src="audio/steps/step-03.webm" type="audio/webm"></audio>

[Sound after step 3 — WebM/Opus](audio/steps/step-03.webm)

## Step 4 — Add a damped hall after the echoes

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.803279 and damping is 0.8. 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.803279 |
| Damping | 0.8 |
| Predelay | 30 ms |
| External room wet | 20% |



<audio controls preload="none" aria-label="SuperCollider Amber Crown after step 4"><source src="audio/steps/step-04.webm" type="audio/webm"></audio>

[Sound after step 4 — WebM/Opus](audio/steps/step-04.webm)

## Step 5 — Focus the bass and apply the output gain

Set `~soundStage = 5` for the finished sound. Convert the delay-and-hall mix to mid/side and highpass only the side at 160 Hz. Reconstruct both channels, apply +8.12 dB and remove DC.


Reducing low side energy gives the moving upper image a more stable bass center. The output gain follows every effect, so it raises the body and tails together. The shared effects Synth runs after the note group and carries the delay and reverb tail. The finished tone has a soft triangle body, a slower octave sheen and a wide, moving upper tail.

<audio controls preload="none" aria-label="SuperCollider Amber Crown after step 5"><source src="audio/steps/step-05.webm" type="audio/webm"></audio>

[Sound after step 5 — WebM/Opus](audio/steps/step-05.webm)

## Downloads and settings

[Finished sound — WebM/Opus](audio/amber-crown.webm) · [Complete settings](ALL_PARAMETERS.md) · [Ableton version](/tutorials/amber-crown/) · [Csound version](/tutorials/amber-crown/csound/)

## Full SuperCollider script

The complete Amber Crown 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.

```supercollider
(
~soundStage = 5;
~soundOutputScale = 0.5933138;
~soundRelease = 2.26;
~soundNames = (motion: \pgAmberCrownMotion, voice: \pgAmberCrownVoice, effects: \pgAmberCrownEffects);
~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);
};
~pgSwarm = { |freq, cents, phase|
    var drift = SinOsc.kr(0.12 + (cents.abs * 0.005), phase * 2pi) * 1.2;
    ~pgTriangle.(freq * (2 ** ((cents + drift) / 1200)), phase);
};
~soundDefs = [
    SynthDef(\pgAmberCrownMotion, { |out=0| Out.kr(out, DC.kr(0)) }),
    SynthDef(\pgAmberCrownVoice, { |out=0, midi=60, velocity=0.8, gate=1, startMidi=60|
        var stage = ~soundStage;
    var a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, aAL = 0, aAR = 0, aB = 0;
    var aBL = 0, aBR = 0, aOutL = 0, aOutR = 0, iACents = 0, iBase = 0, iHz = 0, iVelocity = 0;
    var kEnvA = 0, kEnvB = 0, kGain = 0, pan26 = 0;
    iHz = (midi).midicps;
    iVelocity = (velocity).clip(0, 1);
    iACents = 0;
    if((stage >= 2)) {
    iACents = (0 - 3.125);
    };
    iBase = (iHz * (2 ** (iACents / 1200)));
    a1 = ~pgSwarm.(iBase, (0 - 17.7), 0.05);
    a2 = ~pgSwarm.(iBase, (0 - 8.85), 0.23);
    a3 = ~pgSwarm.(iBase, 0, 0.41);
    a4 = ~pgSwarm.(iBase, 8.85, 0.62);
    a5 = ~pgSwarm.(iBase, 17.7, 0.84);
    kEnvA = EnvGen.kr(Env([0, 1, ((0 - 4)).dbamp, 0], [0.473, 2.43, 2.26], \lin, releaseNode: 2), gate);
    aAL = (((((a1 + a2) + a3) + a4) + a5) / 5);
    aAR = aAL;
    aBL = 0;
    aBR = 0;
    if((stage >= 2)) {
    aAL = ((((((a1 * 0.8) + (a2 * 0.7)) + (a3 * 0.5)) + (a4 * 0.3)) + (a5 * 0.2)) / 2.5);
    aAR = ((((((a1 * 0.2) + (a2 * 0.3)) + (a3 * 0.5)) + (a4 * 0.7)) + (a5 * 0.8)) / 2.5);
    aAL = RLPF.ar(aAL, (2070).clip(20, 18000), (1 / 1.2).clip(0.05, 2));
    aAR = RLPF.ar(aAR, (2070).clip(20, 18000), (1 / 1.2).clip(0.05, 2));
    aAR = (aAR * 0.85);
    kEnvB = EnvGen.kr(Env([0, 1, ((0 - 6)).dbamp, 0], [1.10, 4.00, 2.20], \lin, releaseNode: 2), gate);
    aB = (SinOsc.ar(((iHz * 2) * (2 ** (3.125 / 1200))), 0.17 * 2pi) * (kEnvB * ((0 - 22)).dbamp));
    aB = LPF.ar(aB, (3600).clip(20, 18000));
    pan26 = Pan2.ar(aB, (0.625 * 2) - 1);
    aBL = pan26[0];
    aBR = pan26[1];
    };
    aAL = ((aAL * kEnvA) * ((0 - 10)).dbamp);
    aAR = ((aAR * kEnvA) * ((0 - 10)).dbamp);
    kGain = ((0.5 + (0.5 * iVelocity)) * ((0 - 8)).dbamp);
    aOutL = (((((aAL + aBL) * 1.1)).tanh / 1.1) * kGain);
    aOutR = (((((aAR + aBR) * 1.1)).tanh / 1.1) * kGain);
    Out.ar(out, [aOutL, aOutR]);
        EnvGen.kr(Env.asr(0.0001, 1, 2.26), gate, doneAction: 2);
    }),
    SynthDef(\pgAmberCrownEffects, { |in=0, out=0|
        var stage = ~soundStage;
        var outputScale = ~soundOutputScale;
        var input = In.ar(in, 2);
    var feedback = LocalIn.ar(2);
    var aDelayL = 0, aDelayR = 0, aDryL = 0, aDryR = 0, aEchoL = 0, aEchoR = 0, aFeedbackL = 0, aFeedbackR = 0;
    var aHallL = 0, aHallR = 0, aMid = 0, aMixL = 0, aMixR = 0, aPreL = 0, aPreR = 0, aSide = 0;
    var kCenter = 0, kMotion = 0, room25 = 0;
    aDryL = input[0];
    aDryR = input[1];
    aFeedbackL = feedback[0];
    aFeedbackR = feedback[1];
    if((stage >= 3)) {
    kMotion = (SinOsc.kr(0.18, 0 * 2pi) * 1);
    aDelayL = K2A.ar((340 * (1 + (0.02 * kMotion))));
    aDelayR = K2A.ar((470 * (1 - (0.02 * kMotion))));
    aEchoL = DelayC.ar((aDryL + (aFeedbackR * 0.30)), 1000 / 1000, (aDelayL / 1000).clip(0.00002, 1000 / 1000));
    aEchoR = DelayC.ar((aDryR + (aFeedbackL * 0.30)), 1000 / 1000, (aDelayR / 1000).clip(0.00002, 1000 / 1000));
    kCenter = (1700 * (2 ** (0.04 * kMotion)));
    aEchoL = HPF.ar(aEchoL, ((kCenter / (2 ** 1.5))).clip(20, 18000));
    aEchoL = LPF.ar(aEchoL, ((kCenter * (2 ** 1.5))).clip(20, 18000));
    aEchoR = HPF.ar(aEchoR, ((kCenter / (2 ** 1.5))).clip(20, 18000));
    aEchoR = LPF.ar(aEchoR, ((kCenter * (2 ** 1.5))).clip(20, 18000));
    aFeedbackL = aEchoL;
    aFeedbackR = aEchoR;
    aDryL = ((aDryL * 0.78) + (aEchoL * 0.22));
    aDryR = ((aDryR * 0.78) + (aEchoR * 0.22));
    };
    aMixL = aDryL;
    aMixR = aDryR;
    if((stage >= 4)) {
    aPreL = DelayN.ar(aDryL, 0.030, 0.030);
    aPreR = DelayN.ar(aDryR, 0.030, 0.030);
    room25 = FreeVerb2.ar(aPreL, aPreR, 1, 0.803279, 0.8);
    aHallL = room25[0];
    aHallR = room25[1];
    aMixL = ((aDryL * 0.80) + (aHallL * 0.20));
    aMixR = ((aDryR * 0.80) + (aHallR * 0.20));
    };
    if((stage >= 5)) {
    aMid = ((aMixL + aMixR) * 0.5);
    aSide = ((aMixL - aMixR) * 0.5);
    aSide = HPF.ar(aSide, (160).clip(20, 18000));
    aMixL = LeakDC.ar(((aMid + aSide) * (8.12).dbamp), 0.995);
    aMixR = LeakDC.ar(((aMid - aSide) * (8.12).dbamp), 0.995);
    };
    LocalOut.ar([aFeedbackL, aFeedbackR].collect { |channel| channel + DC.ar(0) });
    Out.ar(out, [(aMixL * outputScale), (aMixR * 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]);
        "Amber Crown 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.() };
)
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/amber-crown/supercollider/)
