playgrid.ccRead tutorial

Tutorial 112 / SuperCollider

Build Porcelain Steps in SuperCollider

Build Porcelain Steps in SuperCollider with modal mallet, explicit envelopes and the sound-shaping chain explained in the guide.

4 stepsModal MalletSuperCollider

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

Excite the marimba-like mode bank

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 2 ms mallet pulse with 15% contact noise, lowpassed at 5000 Hz. Feed ratios 1, 4, 10 and 19.9 with progressively shorter decays. The non-harmonic spacing and fast upper-mode decay give a hollow, wooden strike. This four-mode bank interprets Collision's Marimba model; it does not implement the original material or listening-position solver.

SuperCollider control Value
Ratios / weights 1/4/10/19.9; weights 1/0.35/0.12/0.04
T60 per mode 1.5/0.8/0.4/0.2 s
Mallet / resonator / instrument −12 / −6 / −9 dB
Modal scale 0.04
Touch 0.4 + 0.6 × velocity

Sound after step 1 — WebM/Opus

Next: Add the quieter upper beam →

Step 02 / 4

Add the quieter upper beam

Set ~soundStage = 2 in the full script. Mix a second set of modes at ratios 2, 5.52 and 10.8, with 450 ms decay and −24 dB gain. The beam adds a short higher edge without replacing the main struck body. The two banks receive the same excitation in parallel, matching the source's 1 + 2 signal-flow idea. Their explicit modal ratios interpret the beam's tuning and inharmonicity.

SuperCollider control Value
Beam ratios / weights 2/5.52/10.8; 1/0.35/0.12
Beam T60 / gain 450 ms / −24 dB
Maximum modal frequency 11000 Hz
Natural tail lifetime 4 s beyond held duration

Sound after step 2 — WebM/Opus

Next: Surround the tone with a damped room →

Step 03 / 4

Surround the tone with a damped room

Set ~soundStage = 3 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.48459 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.48459
Damping 0.71875
Predelay 12 ms
External room wet 18%
SuperCollider control Value
Room side multiplier 1
Room input cuts Off

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 -4.51 dB gain after the effects. Scale the side signal by 1, preserving the center. Highpass only the side at 160 Hz to focus the lowest frequencies. 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 -4.51 dB
Width 1 × side
Bass side cutoff 160 Hz
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 Porcelain Steps 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 = 3.644688;
~soundRelease = 4;
~soundNames = (motion: \pgPorcelainStepsMotion, voice: \pgPorcelainStepsVoice, effects: \pgPorcelainStepsEffects);

~soundDefs = [
    SynthDef(\pgPorcelainStepsMotion, { |out=0| Out.kr(out, DC.kr(0)) }),
    SynthDef(\pgPorcelainStepsVoice, { |out=0, midi=60, velocity=0.8, gate=1, startMidi=60|
        var stage = ~soundStage;
    var aBeam0 = 0, aBeam1 = 0, aBeam2 = 0, aExc = 0, aHit = 0, aL = 0, aMode0 = 0, aMode1 = 0;
    var aMode2 = 0, aMode3 = 0, aNoise = 0, aR = 0, aSum = 0, iHz = 0, iVelocity = 0;
    iHz = (midi).midicps;
    iVelocity = (velocity).clip(0, 1);
    aHit = EnvGen.ar(Env([0, 1, 0, 0], [0.0002, 0.0018, 1], \lin));
    aNoise = WhiteNoise.ar(1);
    aExc = OnePole.ar((aHit * (1 + (0.15 * aNoise))), (-2pi * (5000).clip(20, 18000) / SampleRate.ir).exp);
    aSum = 0;
    aMode0 = Ringz.ar(aExc, ((11000).min((iHz * 1))).clip(20, 11000), (((((3.14159265 * (11000).min((iHz * 1))) * 1.5) / (1000).log) * 1000.log) / (pi * (11000).min((iHz * 1)))).clip(0.0001, 60));
    aSum = (aSum + (aMode0 * 1));
    aMode1 = Ringz.ar(aExc, ((11000).min((iHz * 4))).clip(20, 11000), (((((3.14159265 * (11000).min((iHz * 4))) * 0.8) / (1000).log) * 1000.log) / (pi * (11000).min((iHz * 4)))).clip(0.0001, 60));
    aSum = (aSum + (aMode1 * 0.35));
    aMode2 = Ringz.ar(aExc, ((11000).min((iHz * 10))).clip(20, 11000), (((((3.14159265 * (11000).min((iHz * 10))) * 0.4) / (1000).log) * 1000.log) / (pi * (11000).min((iHz * 10)))).clip(0.0001, 60));
    aSum = (aSum + (aMode2 * 0.12));
    aMode3 = Ringz.ar(aExc, ((11000).min((iHz * 19.9))).clip(20, 11000), (((((3.14159265 * (11000).min((iHz * 19.9))) * 0.2) / (1000).log) * 1000.log) / (pi * (11000).min((iHz * 19.9)))).clip(0.0001, 60));
    aSum = (aSum + (aMode3 * 0.04));
    aSum = (((aSum * ((0 - 12)).dbamp) * ((0 - 6)).dbamp) * 0.04);
    if((stage >= 2)) {
    aBeam0 = Ringz.ar(aExc, ((11000).min((iHz * 2))).clip(20, 11000), (((((3.14159265 * (11000).min((iHz * 2))) * 0.45) / (1000).log) * 1000.log) / (pi * (11000).min((iHz * 2)))).clip(0.0001, 60));
    aSum = (aSum + (((aBeam0 * 1) * ((0 - 24)).dbamp) * 0.04));
    aBeam1 = Ringz.ar(aExc, ((11000).min((iHz * 5.52))).clip(20, 11000), (((((3.14159265 * (11000).min((iHz * 5.52))) * 0.45) / (1000).log) * 1000.log) / (pi * (11000).min((iHz * 5.52)))).clip(0.0001, 60));
    aSum = (aSum + (((aBeam1 * 0.35) * ((0 - 24)).dbamp) * 0.04));
    aBeam2 = Ringz.ar(aExc, ((11000).min((iHz * 10.8))).clip(20, 11000), (((((3.14159265 * (11000).min((iHz * 10.8))) * 0.45) / (1000).log) * 1000.log) / (pi * (11000).min((iHz * 10.8)))).clip(0.0001, 60));
    aSum = (aSum + (((aBeam2 * 0.12) * ((0 - 24)).dbamp) * 0.04));
    };
    aL = ((aSum * ((0 - 9)).dbamp) * (0.4 + (0.6 * iVelocity)));
    aR = aL;
    Out.ar(out, [aL, aR]);
        EnvGen.kr(Env.asr(0.0001, 1, 4), gate, doneAction: 2);
    }),
    SynthDef(\pgPorcelainStepsEffects, { |in=0, out=0|
        var stage = ~soundStage;
        var outputScale = ~soundOutputScale;
        var input = In.ar(in, 2);
    var aEndMid = 0, aEndSide = 0, aL = 0, aR = 0, aRoomInL = 0, aRoomInR = 0, aRoomL = 0, aRoomMid = 0;
    var aRoomPreL = 0, aRoomPreR = 0, aRoomR = 0, aRoomSide = 0, room7 = 0;
    aL = input[0];
    aR = input[1];
    if((stage >= 3)) {
    aRoomInL = aL;
    aRoomPreL = DelayN.ar(aRoomInL, 0.012, 0.012);
    aRoomInR = aR;
    aRoomPreR = DelayN.ar(aRoomInR, 0.012, 0.012);
    room7 = FreeVerb2.ar(aRoomPreL, aRoomPreR, 1, 0.48459, 0.71875);
    aRoomL = room7[0];
    aRoomR = room7[1];
    aRoomMid = ((aRoomL + aRoomR) * 0.5);
    aRoomSide = (((aRoomL - aRoomR) * 0.5) * 1);
    aL = ((aL * 0.8200000000000001) + ((aRoomMid + aRoomSide) * 0.18));
    aR = ((aR * 0.8200000000000001) + ((aRoomMid - aRoomSide) * 0.18));
    };
    if((stage >= 4)) {
    aEndMid = ((aL + aR) * 0.5);
    aEndSide = (((aL - aR) * 0.5) * 1.0);
    aEndSide = HPF.ar(aEndSide, (160.0).clip(20, 18000));
    aL = ((aEndMid + aEndSide) * ((0 - 4.51)).dbamp);
    aL = LeakDC.ar(aL, 0.995);
    aR = ((aEndMid - aEndSide) * ((0 - 4.51)).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]);
        "Porcelain Steps 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.() };
)