playgrid.ccRead tutorial

Tutorial 044 / SuperCollider

Build Ember Thump in SuperCollider

Build Ember Thump in SuperCollider with synth percussion, explicit envelopes and the sound-shaping chain explained in the guide.

4 stepsSynth PercussionSuperCollider

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

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 -3.0 dB, transposed -12 semitones. Attack is 0.0005 seconds, exponential decay 0.46 seconds, sustain 0 and release 0.15 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.0005 / 0.46 / 0 / 0.15
Instrument gain -10 dB
Transpose -12 st

Sound after step 1 — WebM/Opus

Next: Build the characteristic spectrum →

Step 02 / 4

Build the characteristic spectrum

Set ~soundStage = 2 in the full script. Add a 24-semitone opening pitch offset that falls to zero over 42 ms, then lowpass at 3200 Hz. The quick drop creates the kick punch while the decaying sine supplies the low body. 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 24 st pitch drop, 42 ms
Filter 3.20 kHz
Filter type Lowpass

Sound after step 2 — WebM/Opus

Next: Round the signal with saturation →

Step 03 / 4

Round the signal with saturation

Set ~soundStage = 3 in the full script. Use +4 dB drive with 75% shaped signal and -3 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 4 / -3 dB
Shaped mix 75%
Input DC removal LeakDC, coefficient 0.995

Sound after step 3 — WebM/Opus

Next: Set the final width and gain →

Step 04 / 4

Set the final width and gain

Set ~soundStage = 4 in the full script. Use 0.25 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.25 dB
Width Mono
Bass side cutoff Off
DC removal LeakDC, coefficient 0.995

Sound after step 4 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full SuperCollider script

The complete Ember Thump instrument uses stock SuperCollider units. Set ~soundStage from 1 to 4 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 = 4;
~soundOutputScale = 0.8708327;
~soundRelease = 0.15;
~soundNames = (motion: \pgEmberThumpMotion, voice: \pgEmberThumpVoice, effects: \pgEmberThumpEffects);

~soundDefs = [
    SynthDef(\pgEmberThumpMotion, { |out=0| Out.kr(out, DC.kr(0)) }),
    SynthDef(\pgEmberThumpVoice, { |out=0, midi=60, velocity=0.8, gate=1, startMidi=60|
        var stage = ~soundStage;
    var aAmp = 0, aAmpDecay = 0, aAmpGate = 0, aL = 0, aR = 0, aSource = 0, iHz = 0, iVelocity = 0;
    var kHz = 0, kPitch = 0;
    iHz = (midi).midicps;
    iVelocity = (velocity).clip(0, 1);
    kPitch = 0;
    if((stage >= 2)) {
    kPitch = EnvGen.kr(Env([24, 0, 0], [0.042, 1], \lin));
    };
    kHz = (iHz * (2 ** (((0 - 12.0) + kPitch) / 12)));
    aSource = (SinOsc.ar(kHz, 0 * 2pi) * ((0 - 3.0)).dbamp);
    aAmpGate = EnvGen.ar(Env([0, 1, 1], [0.0005, 1], \lin));
    aAmpDecay = EnvGen.ar(Env([1, 1, 1e-06, 0.000001], [0.0005, 0.46, 0.15], \exp, releaseNode: 2), gate);
    aAmp = (aAmpGate * aAmpDecay);
    aSource = (aSource * aAmp);
    if((stage >= 2)) {
    aSource = LPF.ar(aSource, (3200).clip(20, 18000));
    };
    aL = ((aSource * ((0 - 10.0)).dbamp) * (0.4 + (0.6 * iVelocity)));
    aR = aL;
    Out.ar(out, [aL, aR]);
        EnvGen.kr(Env.asr(0.0001, 1, 0.15), gate, doneAction: 2);
    }),
    SynthDef(\pgEmberThumpEffects, { |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, aShapeL = 0, aShapeR = 0;
    aL = input[0];
    aR = input[1];
    if((stage >= 3)) {
    aCleanL = LeakDC.ar(aL, 0.995);
    aShapeL = ((((aCleanL * 3) * (4.0).dbamp)).tanh / 3);
    aL = (((aCleanL * 0.25) + (aShapeL * 0.75)) * ((0 - 3.0)).dbamp);
    aCleanR = LeakDC.ar(aR, 0.995);
    aShapeR = ((((aCleanR * 3) * (4.0).dbamp)).tanh / 3);
    aR = (((aCleanR * 0.25) + (aShapeR * 0.75)) * ((0 - 3.0)).dbamp);
    };
    if((stage >= 4)) {
    aEndMid = ((aL + aR) * 0.5);
    aEndSide = (((aL - aR) * 0.5) * 0);
    aL = ((aEndMid + aEndSide) * (0.25).dbamp);
    aL = LeakDC.ar(aL, 0.995);
    aR = ((aEndMid - aEndSide) * (0.25).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]);
        "Ember Thump 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.() };
)