# Build Flint Snap in SuperCollider

A stock-unit SuperCollider interpretation of [the Ableton sound](/tutorials/flint-snap/) and its [Csound version](/tutorials/flint-snap/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 the sine body

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 a retriggered sine at -8.0 dB, transposed 0 semitones. Attack is 0.0003 seconds, exponential decay 0.11 seconds, sustain 0 and release 0.08 seconds. Positive exponential floors stand in for silence. The contour starts again for each played note; it differs from Operator's Trigger envelope behavior on very short held notes.

| SuperCollider control | Value |
| --- | --- |
| Carrier | Sine, phase 0 |
| Amplitude A/D/S/R | 0.0003 / 0.11 / 0 / 0.08 |
| Instrument gain | -12 dB |
| Transpose | 0 st |

<audio controls preload="none" aria-label="SuperCollider Flint Snap 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 — Build the characteristic spectrum

Set `~soundStage = 2` in the full script. Add a separately decaying white-noise layer at −5 dB with 190 ms decay and 100 ms release. Highpass the combined body at 160 Hz, leaving a pitched knock underneath the noise snap. The exact source circuit and low-level envelope behavior are represented by the explicit code in the full script.

| SuperCollider control | Value |
| --- | --- |
| Added source / motion | White noise: −5 dB; 190 ms decay |
| Filter | 160 Hz |
| Filter type | Highpass |

<audio controls preload="none" aria-label="SuperCollider Flint Snap 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 — Round the signal with saturation

Set `~soundStage = 3` in the full script. Use +3 dB drive with 60% shaped signal and -2 dB output trim. The smooth curve is `tanh(input × 3 × drive.dbamp) / 3`; the other portion stays clean. Louder peaks enter its curved region more strongly, adding harmonics and rounding the envelope. This interprets the source saturation curve rather than implementing its proprietary transfer function.

| SuperCollider control | Value |
| --- | --- |
| Drive / output | 3 / -2 dB |
| Shaped mix | 60% |
| Input DC removal | LeakDC, coefficient 0.995 |

<audio controls preload="none" aria-label="SuperCollider Flint Snap 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 — 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.15 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.15 |
| Damping | 0.71875 |
| Predelay | 5 ms |
| External room wet | 9% |

| SuperCollider control | Value |
| --- | --- |
| Room side multiplier | 1 |
| Room input cuts | Off |

<audio controls preload="none" aria-label="SuperCollider Flint Snap 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 — Set the final width and gain

Set `~soundStage = 5` in the full script. Use -0.77 dB gain after the effects. Average the channels for identical mono outputs. 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 | -0.77 dB |
| Width | Mono |
| Bass side cutoff | Off |
| DC removal | LeakDC, coefficient 0.995 |

<audio controls preload="none" aria-label="SuperCollider Flint Snap 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/flint-snap.webm) · [Complete settings](ALL_PARAMETERS.md) · [Ableton version](/tutorials/flint-snap/) · [Csound version](/tutorials/flint-snap/csound/)

## Full SuperCollider script

The complete Flint Snap 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 = 1.234493;
~soundRelease = 0.1;
~soundNames = (motion: \pgFlintSnapMotion, voice: \pgFlintSnapVoice, effects: \pgFlintSnapEffects);

~soundDefs = [
    SynthDef(\pgFlintSnapMotion, { |out=0| Out.kr(out, DC.kr(0)) }),
    SynthDef(\pgFlintSnapVoice, { |out=0, midi=60, velocity=0.8, gate=1, startMidi=60|
        var stage = ~soundStage;
    var aAmp = 0, aAmpDecay = 0, aAmpGate = 0, aL = 0, aNoise = 0, aNoiseEnv = 0, aNoiseEnvDecay = 0, aNoiseEnvGate = 0;
    var aR = 0, aSource = 0, iHz = 0, iVelocity = 0, kHz = 0, kPitch = 0;
    iHz = (midi).midicps;
    iVelocity = (velocity).clip(0, 1);
    kPitch = 0;
    kHz = (iHz * (2 ** ((0.0 + kPitch) / 12)));
    aSource = (SinOsc.ar(kHz, 0 * 2pi) * ((0 - 8.0)).dbamp);
    aAmpGate = EnvGen.ar(Env([0, 1, 1], [0.0003, 1], \lin));
    aAmpDecay = EnvGen.ar(Env([1, 1, 1e-06, 0.000001], [0.0003, 0.11, 0.08], \exp, releaseNode: 2), gate);
    aAmp = (aAmpGate * aAmpDecay);
    aSource = (aSource * aAmp);
    if((stage >= 2)) {
    aNoise = WhiteNoise.ar(((0 - 5)).dbamp);
    aNoiseEnvGate = EnvGen.ar(Env([0, 1, 1], [0.0005, 1], \lin));
    aNoiseEnvDecay = EnvGen.ar(Env([1, 1, 1e-06, 0.000001], [0.0005, 0.19, 0.1], \exp, releaseNode: 2), gate);
    aNoiseEnv = (aNoiseEnvGate * aNoiseEnvDecay);
    aSource = (aSource + (aNoise * aNoiseEnv));
    aSource = HPF.ar(aSource, (160).clip(20, 18000));
    };
    aL = ((aSource * ((0 - 12.0)).dbamp) * (0.4 + (0.6 * iVelocity)));
    aR = aL;
    Out.ar(out, [aL, aR]);
        EnvGen.kr(Env.asr(0.0001, 1, 0.1), gate, doneAction: 2);
    }),
    SynthDef(\pgFlintSnapEffects, { |in=0, out=0|
        var stage = ~soundStage;
        var outputScale = ~soundOutputScale;
        var input = In.ar(in, 2);
    var aCleanL = 0, aCleanR = 0, aEndMid = 0, aEndSide = 0, aL = 0, aR = 0, aRoomInL = 0, aRoomInR = 0;
    var aRoomL = 0, aRoomMid = 0, aRoomPreL = 0, aRoomPreR = 0, aRoomR = 0, aRoomSide = 0, aShapeL = 0, aShapeR = 0;
    var room15 = 0;
    aL = input[0];
    aR = input[1];
    if((stage >= 3)) {
    aCleanL = LeakDC.ar(aL, 0.995);
    aShapeL = ((((aCleanL * 3) * (3.0).dbamp)).tanh / 3);
    aL = (((aCleanL * 0.4) + (aShapeL * 0.6)) * ((0 - 2.0)).dbamp);
    aCleanR = LeakDC.ar(aR, 0.995);
    aShapeR = ((((aCleanR * 3) * (3.0).dbamp)).tanh / 3);
    aR = (((aCleanR * 0.4) + (aShapeR * 0.6)) * ((0 - 2.0)).dbamp);
    };
    if((stage >= 4)) {
    aRoomInL = aL;
    aRoomPreL = DelayN.ar(aRoomInL, 0.005, 0.005);
    aRoomInR = aR;
    aRoomPreR = DelayN.ar(aRoomInR, 0.005, 0.005);
    room15 = FreeVerb2.ar(aRoomPreL, aRoomPreR, 1, 0.15, 0.71875);
    aRoomL = room15[0];
    aRoomR = room15[1];
    aRoomMid = ((aRoomL + aRoomR) * 0.5);
    aRoomSide = (((aRoomL - aRoomR) * 0.5) * 1);
    aL = ((aL * 0.91) + ((aRoomMid + aRoomSide) * 0.09));
    aR = ((aR * 0.91) + ((aRoomMid - aRoomSide) * 0.09));
    };
    if((stage >= 5)) {
    aEndMid = ((aL + aR) * 0.5);
    aEndSide = (((aL - aR) * 0.5) * 0);
    aL = ((aEndMid + aEndSide) * ((0 - 0.77)).dbamp);
    aL = LeakDC.ar(aL, 0.995);
    aR = ((aEndMid - aEndSide) * ((0 - 0.77)).dbamp);
    aR = LeakDC.ar(aR, 0.995);
    };
    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]);
        "Flint Snap 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/flint-snap/supercollider/)
