playgrid.ccRead tutorial

Tutorial 004 / SuperCollider

Build Three Octave Bass in SuperCollider

Build Three Octave Bass in SuperCollider with octave saw bass, explicit envelopes and the sound-shaping chain explained in the guide.

3 stepsOctave Saw BassSuperCollider

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

Stack the three octave saws

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 ratios 0.25, 0.5005 and 1 relative to the played pitch, each at −9.1 dB. These express global transposition −24 st with source ratios 1/2/4. The small middle offset interprets Fine 1. Use a 2 ms attack, full sustain, 44.9 ms release and −15 dB instrument gain.

SuperCollider control Value
Ratios / levels 0.25 / 0.5005 / 1; −9.1 dB each
Amplitude 2 ms attack, full sustain, 44.9 ms release
Instrument −15 dB

Sound after step 1 — WebM/Opus

Next: Drive a tracked closing lowpass →

Step 02 / 3

Drive a tracked closing lowpass

Set ~soundStage = 2 in the full script. Apply +12 dB smooth input drive and a 24 dB ladder lowpass. Its base is 1000 Hz, with full keyboard tracking, 0.3-octave velocity depth and a 1.44-octave envelope. A 2 ms rise and 2.2 s fall bring the initial brightness toward the darker body. The ladder replaces PRD with its own response.

SuperCollider control Value
Cutoff 1000 × 2^(1.44 × envelope + (note−60)/12 + 0.3 × velocity) Hz
Contour 2 ms / 2.2 s / zero / 44.9 ms
Filter drive / resonance +12 dB / zero

For MoogFF, multiply the stated source resonance amount by four to obtain its 0–4 gain argument (limited to 3.95). The complete script gives this gain expression beside each cutoff.

Sound after step 2 — WebM/Opus

Next: Round the signal with saturation →

Step 03 / 3

Round the signal with saturation

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

Sound after step 3 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full SuperCollider script

The complete Three Octave Bass instrument uses stock SuperCollider units. Set ~soundStage from 1 to 3 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 = 3;
~soundOutputScale = 1.711981;
~soundRelease = 0.05;
~soundNames = (motion: \pgThreeOctaveBassMotion, voice: \pgThreeOctaveBassVoice, effects: \pgThreeOctaveBassEffects);

~soundDefs = [
    SynthDef(\pgThreeOctaveBassMotion, { |out=0| Out.kr(out, DC.kr(0)) }),
    SynthDef(\pgThreeOctaveBassVoice, { |out=0, midi=60, velocity=0.8, gate=1, startMidi=60|
        var stage = ~soundStage;
    var aA = 0, aB = 0, aC = 0, aDrive = 0, aL = 0, aR = 0, aSource = 0, iHz = 0;
    var iVelocity = 0, kAmp = 0, kCut = 0, kFilter = 0;
    iHz = (midi).midicps;
    iVelocity = (velocity).clip(0, 1);
    aA = (Saw.ar((iHz * 0.25)) * ((0 - 9.1)).dbamp);
    aB = (Saw.ar((iHz * 0.5005)) * ((0 - 9.1)).dbamp);
    aC = (Saw.ar(iHz) * ((0 - 9.1)).dbamp);
    aSource = ((aA + aB) + aC);
    if((stage >= 2)) {
    kFilter = EnvGen.kr(Env([0, 1, 0, 0], [0.002, 2.2, 0.0449], \lin, releaseNode: 2), gate);
    kCut = ((1000 * (2 ** (((1.44 * kFilter) + ((midi - 60) / 12)) + (0.3 * iVelocity))))).clip(30, 18000);
    aDrive = ((aSource * (12).dbamp)).tanh;
    aSource = MoogFF.ar(aDrive, (kCut).clip(20, 18000), (0 * 4).clip(0, 3.95));
    };
    kAmp = EnvGen.kr(Env([0, 1, 1, 0], [0.002, 0.5, 0.0449], \lin, releaseNode: 2), gate);
    aL = ((aSource * kAmp) * ((0 - 15)).dbamp);
    aR = aL;
    Out.ar(out, [aL, aR]);
        EnvGen.kr(Env.asr(0.0001, 1, 0.05), gate, doneAction: 2);
    }),
    SynthDef(\pgThreeOctaveBassEffects, { |in=0, out=0|
        var stage = ~soundStage;
        var outputScale = ~soundOutputScale;
        var input = In.ar(in, 2);
    var aCleanL = 0, aCleanR = 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) * (12).dbamp)).tanh / 3);
    aL = (((aCleanL * 0) + (aShapeL * 1)) * ((0 - 11)).dbamp);
    aCleanR = LeakDC.ar(aR, 0.995);
    aShapeR = ((((aCleanR * 3) * (12).dbamp)).tanh / 3);
    aR = (((aCleanR * 0) + (aShapeR * 1)) * ((0 - 11)).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]);
        "Three Octave Bass 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.() };
)