# Build Porcelain Steps in Csound

[SuperCollider version](/tutorials/porcelain-steps/supercollider/): the same sound interpreted with stock SuperCollider synthesis units.

Porcelain Steps in Csound follows the sound-shaping ideas of the [Ableton Collision version](/tutorials/porcelain-steps/), using the explicit oscillators, contours and effects below.

[Starting settings](STARTING_STATE.md) · [Complete settings](ALL_PARAMETERS.md). The complete script follows the final step and related sounds.

## Step 1 — Excite the marimba-like mode bank

Set `giStage init 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.

| Csound 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 |

<audio controls preload="none" aria-label="Csound Porcelain Steps 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 — Add the quieter upper beam

Set `giStage init 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.

| Csound 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 |

<audio controls preload="none" aria-label="Csound Porcelain Steps 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 — Surround the tone with a damped room

Set `giStage init 3` in the full script. Feed the preceding signal through 12 ms predelay into `reverbsc`, with feedback 0.6456, 4500 Hz damping and 18% wet mix. Predelay leaves the initial articulation in front; feedback prolongs the tail, while damping darkens repeated circulation. The source room decay setting is 1.6 seconds, but Csound feedback is not a decay-time control: this is an interpretation of that space, with different diffusion and modulation. 

| Csound control | Value |
| --- | --- |
| Source decay target | 1.6 s (not a measured Csound decay) |
| Predelay / feedback | 12 ms / 0.6456 |
| Damping / wet | 4500 Hz / 18% |
| Room side multiplier | 1 |
| Room input cuts | Off |

<audio controls preload="none" aria-label="Csound Porcelain Steps 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 — Set the final width and gain

Set `giStage init 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 order-2048 DC removal, using a longer window to limit low-note loss. The fixed output-scale control at the end of instrument 90 remains a separate Csound gain setting. Clear the shared note buses only after processing them; effect memories continue carrying their own tails.

| Csound control | Value |
| --- | --- |
| Final gain | -4.51 dB |
| Width | 1 × side |
| Bass side cutoff | 160 Hz |
| DC removal | Order 2048 |

<audio controls preload="none" aria-label="Csound Porcelain Steps 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)

## Downloads and settings

[Finished sound — WebM/Opus](audio/porcelain-steps.webm) · [Complete settings](ALL_PARAMETERS.md) · [Ableton version](/tutorials/porcelain-steps/)

## Full Csound script

This document contains the complete Porcelain Steps source, shared effects and example score. `giStage` selects the cumulative stages from 1 to 4; 4 is the finished sound.

```csound
<CsoundSynthesizer>
<CsOptions>
-odac -d
</CsOptions>
<CsInstruments>
sr = 48000
ksmps = 16
nchnls = 2
0dbfs = 1

giStage init 4
giOutputScale init 8.34671
giSine ftgen 0, 0, 16384, 10, 1
gaLeft init 0
gaRight init 0

instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  xtratim 4
  aHit linseg 0,0.0002,1,0.0018,0,1,0
  aNoise rand 1
  aExc tone aHit*(1+0.15*aNoise),5000
  aSum = 0
  aMode0 mode aExc,min(11000,iHz*1),3.14159265*min(11000,iHz*1)*1.5/log(1000)
  aSum = aSum+aMode0*1
  aMode1 mode aExc,min(11000,iHz*4),3.14159265*min(11000,iHz*4)*0.8/log(1000)
  aSum = aSum+aMode1*0.35
  aMode2 mode aExc,min(11000,iHz*10),3.14159265*min(11000,iHz*10)*0.4/log(1000)
  aSum = aSum+aMode2*0.12
  aMode3 mode aExc,min(11000,iHz*19.9),3.14159265*min(11000,iHz*19.9)*0.2/log(1000)
  aSum = aSum+aMode3*0.04
  aSum = aSum*ampdb(-12)*ampdb(-6)*0.04
  if giStage >= 2 then
  aBeam0 mode aExc,min(11000,iHz*2),3.14159265*min(11000,iHz*2)*0.45/log(1000)
  aSum = aSum+aBeam0*1*ampdb(-24)*0.04
  aBeam1 mode aExc,min(11000,iHz*5.52),3.14159265*min(11000,iHz*5.52)*0.45/log(1000)
  aSum = aSum+aBeam1*0.35*ampdb(-24)*0.04
  aBeam2 mode aExc,min(11000,iHz*10.8),3.14159265*min(11000,iHz*10.8)*0.45/log(1000)
  aSum = aSum+aBeam2*0.12*ampdb(-24)*0.04
  endif
  aL = aSum*ampdb(-9)*(0.4+0.6*iVelocity)
  aR = aL
  gaLeft = gaLeft+aL
  gaRight = gaRight+aR
endin
instr 90
  aL = gaLeft
  aR = gaRight
  if giStage >= 3 then
    aRoomInL = aL
    aRoomPreL delay aRoomInL, 0.012
    aRoomInR = aR
    aRoomPreR delay aRoomInR, 0.012
    aRoomL, aRoomR reverbsc aRoomPreL, aRoomPreR, 0.6456, 4500.0, sr, 0.4
    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
  endif
  if giStage >= 4 then
    aEndMid = (aL+aR)*0.5
    aEndSide = (aL-aR)*0.5*1.0
    aEndSide butterhp aEndSide, 160.0
    aL = (aEndMid+aEndSide)*ampdb(-4.51)
    aL dcblock2 aL, 2048
    aR = (aEndMid-aEndSide)*ampdb(-4.51)
    aR dcblock2 aR, 2048
  endif
  outs aL*giOutputScale, aR*giOutputScale
  clear gaLeft, gaRight
endin
</CsInstruments>
<CsScore>
; p3 held seconds, p4 MIDI pitch, p5 velocity
i 1 0 1 48 0.75
i 1 4 1 60 0.9
i 1 8 1 64 0.8
i 90 0 23
e
</CsScore>
</CsoundSynthesizer>
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/porcelain-steps/csound/)
