playgrid.ccRead tutorial

Tutorial 013 / SuperCollider

Build Submerged Pulse Horn in SuperCollider

Build Submerged Pulse Horn in SuperCollider with pulse horn, explicit envelopes and the sound-shaping chain explained in the guide.

4 stepsPulse HornSuperCollider

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

Build the low body and reedy upper edge

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 10% pulse at −8 dB and a quiet upper sine at +16 st/−14 cents, −21 dB. A mild tanh shape interprets the upper source warp. Bandpass the main pair at 400 Hz and notch near 805 Hz, while allowing the octave-down sine to bypass those filters and preserve the low anchor. That explicit sub bypass is a SuperCollider interpretation of the source balance. Use a 24 ms opening, full sustain and 3.3 s release.

SuperCollider control Value
Main / upper Pulse width 0.10 at −8 dB; sine +16 st/−14 cents at −21 dB
Sub Octave-down sine, 0 dB, bypasses main filters
Filters 400 Hz bandpass, bandwidth = center; 805 Hz notch, bandwidth = 15% center
Tracking Bandpass 70%; notch 100%
Amplitude 24 ms / 1.28 s / full / 3.3 s
Touch 0.2 + 0.8 × velocity

Sound after step 1 — WebM/Opus

Next: Let the bandpass rise after the attack →

Step 02 / 4

Let the bandpass rise after the attack

Set ~soundStage = 2 in the full script. Open the bandpass by 0.4 octaves under a 510 ms / 1.81 s / zero / 1.35 s contour. The amplitude arrives much earlier than the filter peak, making the color swell over the established low body. The modulation depth and bandwidth interpret the source matrix and resonance values rather than copy its circuits.

SuperCollider control Value
Filter contour 510 ms / 1.81 s / zero / 1.35 s
Filter motion +0.4 octaves

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 +3 dB drive with 100% 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 3 / -3 dB
Shaped mix 100%
Input DC removal Off

Sound after step 3 — WebM/Opus

Next: Widen a dark room around the horn →

Step 04 / 4

Widen a dark room around the horn

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.942951 and damping is 0.84375. 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.942951
Damping 0.84375
Predelay 10 ms
External room wet 40%
SuperCollider control Value
Room side multiplier 1
Room input cuts 275 / 4400 Hz
Final gain 1.5 dB
Width 3 × side
Bass side cutoff Off
DC removal Off

The same stage also applies the output gain and side-width controls shown in the full script; low-cut and high-cut processing affect the room input rather than the direct tone.

Sound after step 4 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full SuperCollider script

The complete Submerged Pulse Horn 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.4362782;
~soundRelease = 3.3;
~soundNames = (motion: \pgSubmergedPulseHornMotion, voice: \pgSubmergedPulseHornVoice, effects: \pgSubmergedPulseHornEffects);

~soundDefs = [
    SynthDef(\pgSubmergedPulseHornMotion, { |out=0| Out.kr(out, DC.kr(0)) }),
    SynthDef(\pgSubmergedPulseHornVoice, { |out=0, midi=60, velocity=0.8, gate=1, startMidi=60|
        var stage = ~soundStage;
    var aL = 0, aMains = 0, aPulse = 0, aR = 0, aSource = 0, aSub = 0, aUpper = 0, iHz = 0;
    var iVelocity = 0, kAmp = 0, kBand = 0, kF = 0, kFilter = 0, kNotch = 0;
    iHz = (midi).midicps;
    iVelocity = (velocity).clip(0, 1);
    aPulse = (Pulse.ar(iHz, 0.10) * ((0 - 8)).dbamp);
    aUpper = (SinOsc.ar((iHz * (2 ** ((16 / 12) - (14 / 1200)))), 0 * 2pi) * ((0 - 21)).dbamp);
    aUpper = (((aUpper * 1.6)).tanh / 1.6);
    aMains = (aPulse + aUpper);
    aSub = (SinOsc.ar((iHz * 0.5), 0 * 2pi) * 1);
    kFilter = 0;
    if((stage >= 2)) {
    kF = EnvGen.kr(Env([0, 1, 0, 0], [0.51, 1.81, 1.35], \lin, releaseNode: 2), gate);
    kFilter = kF;
    };
    kBand = ((400 * (2 ** (((0.7 * (midi - 60)) / 12) + (0.4 * kFilter))))).clip(30, 11000);
    kNotch = ((805 * (2 ** ((midi - 60) / 12)))).clip(30, 18000);
    aMains = BPF.ar((aMains * (3).dbamp), (kBand).clip(20, 18000), (kBand / kBand).clip(0.001, 4));
    aMains = BRF.ar(aMains, (kNotch).clip(20, 18000), ((kNotch * 0.15) / kNotch).clip(0.001, 4));
    aSource = (aMains + aSub);
    kAmp = EnvGen.kr(Env([0, 1, 1, 0], [0.024, 1.28, 3.3], \lin, releaseNode: 2), gate);
    aL = ((aSource * kAmp) * (0.2 + (0.8 * iVelocity)));
    aR = aL;
    Out.ar(out, [aL, aR]);
        EnvGen.kr(Env.asr(0.0001, 1, 3.3), gate, doneAction: 2);
    }),
    SynthDef(\pgSubmergedPulseHornEffects, { |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 room19 = 0;
    aL = input[0];
    aR = input[1];
    if((stage >= 3)) {
    aCleanL = aL;
    aShapeL = ((((aCleanL * 3) * (3).dbamp)).tanh / 3);
    aL = (((aCleanL * 0) + (aShapeL * 1)) * ((0 - 3)).dbamp);
    aCleanR = aR;
    aShapeR = ((((aCleanR * 3) * (3).dbamp)).tanh / 3);
    aR = (((aCleanR * 0) + (aShapeR * 1)) * ((0 - 3)).dbamp);
    };
    if((stage >= 4)) {
    aRoomInL = aL;
    aRoomInL = HPF.ar(aRoomInL, (275).clip(20, 18000));
    aRoomInL = LPF.ar(aRoomInL, (4400).clip(20, 18000));
    aRoomPreL = DelayN.ar(aRoomInL, 0.01, 0.01);
    aRoomInR = aR;
    aRoomInR = HPF.ar(aRoomInR, (275).clip(20, 18000));
    aRoomInR = LPF.ar(aRoomInR, (4400).clip(20, 18000));
    aRoomPreR = DelayN.ar(aRoomInR, 0.01, 0.01);
    room19 = FreeVerb2.ar(aRoomPreL, aRoomPreR, 1, 0.942951, 0.84375);
    aRoomL = room19[0];
    aRoomR = room19[1];
    aRoomMid = ((aRoomL + aRoomR) * 0.5);
    aRoomSide = (((aRoomL - aRoomR) * 0.5) * 1);
    aL = ((aL * 0.6) + ((aRoomMid + aRoomSide) * 0.4));
    aR = ((aR * 0.6) + ((aRoomMid - aRoomSide) * 0.4));
    aEndMid = ((aL + aR) * 0.5);
    aEndSide = (((aL - aR) * 0.5) * 3);
    aL = ((aEndMid + aEndSide) * (1.5).dbamp);
    aR = ((aEndMid - aEndSide) * (1.5).dbamp);
    };
    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]);
        "Submerged Pulse Horn 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.() };
)