# Build Detuned Room Pad in Csound

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

Detuned Room Pad in Csound follows the sound-shaping ideas of the [Ableton Operator version](/tutorials/detuned-room-pad/), 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 — Blend the slowly beating saws

Set `giStage init 1` in the full script. Mix three saws at frequency ratios 1, 1.001 and 1.008 with gains −6, −10 and −6.7 dB. Use 885 ms attack, full sustain and 3 s release at −9 dB instrument gain. The explicit ratio offsets interpret Operator Fine values, which are not cents. Velocity does not alter this source.

| Csound control | Value |
| --- | --- |
| Ratios | 1 / 1.001 / 1.008 |
| Levels | −6 / −10 / −6.7 dB |
| Amplitude | 885 ms attack; full sustain; 3 s release |
| Instrument | −9 dB |

<audio controls preload="none" aria-label="Csound Detuned Room Pad 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 — Open a gentle tracked filter

Set `giStage init 2` in the full script. Use a 2800 Hz ladder lowpass with 0.01 resonance and full pitch tracking. Its contour rises in 92 ms, decays over 4.3 s to 0.72 and releases over 3 s. A chosen 0.9-octave depth interprets the source 15% amount. The filter opens before the slower amplitude peak, then settles into a softer sustained spectrum.

| Csound control | Value |
| --- | --- |
| Cutoff / resonance | 2800 Hz base / 0.01 |
| Contour | 92 ms / 4.3 s / 0.72 / 3 s |
| Envelope / tracking | 0.9 octaves / 1 octave per octave |

<audio controls preload="none" aria-label="Csound Detuned Room Pad 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 — Add moving stereo chorus

Set `giStage init 3` in the full script. Move two delay taps around 15 ms by ±9 ms at 0.6 Hz, with opposite phases and 52% wet mix. The wet inputs remain full-band. Scale side information by 1; tap feedback is 0. These explicit tap depths interpret the source Amount and ensemble movement rather than copy the internal algorithm. Sustained notes reveal slow pitch interference.

| Csound control | Value |
| --- | --- |
| Tap center / excursion | 15 / ±9 ms |
| Rate / wet | 0.6 Hz / 52% |
| Wet highpass | Off |
| Width / feedback | 1 / 0 |
| Warmth shaping | 0% smooth-drive interpretation |

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

Set `giStage init 4` in the full script. Feed the preceding signal through 8 ms predelay into `reverbsc`, with feedback 0.8276, 4500 Hz damping and 50% wet mix. Predelay leaves the initial articulation in front; feedback prolongs the tail, while damping darkens repeated circulation. The source room decay setting is 3.7 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 | 3.7 s (not a measured Csound decay) |
| Predelay / feedback | 8 ms / 0.8276 |
| Damping / wet | 4500 Hz / 50% |
| Room side multiplier | 1 |
| Room input cuts | Off |

<audio controls preload="none" aria-label="Csound Detuned Room Pad 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/Detuned-Room-Pad.webm) · [Complete settings](ALL_PARAMETERS.md) · [Ableton version](/tutorials/detuned-room-pad/)

## Full Csound script

This document contains the complete Detuned Room Pad 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 0.6247424
giSine ftgen 0, 0, 16384, 10, 1
gaLeft init 0
gaRight init 0

instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  aA vco2 ampdb(-6), iHz*1, 0, 0.5, 0
  aB vco2 ampdb(-10), iHz*1.001, 0, 0.5, 0
  aC vco2 ampdb(-6.7), iHz*1.008, 0, 0.5, 0
  aSource = aA+aB+aC
  if giStage >= 2 then
  kFilter linsegr 0, 0.092, 1, 4.3, 0.72, 3, 0
  kCut = limit(2800*pow(2,.9*kFilter+(p4-60)/12),30,18000)
  aSource moogladder aSource,kCut,0.01
  endif
  kAmp linsegr 0, 0.885, 1, 1.21, 1, 3, 0
  aL = aSource*kAmp*ampdb(-9)
  aR = aL
  gaLeft = gaLeft+aL
  gaRight = gaRight+aR
endin
instr 90
  aL = gaLeft
  aR = gaRight
  if giStage >= 3 then
    aChFbL init 0
    aChFbR init 0
    aChInL = aL
    aChInR = aR
    kCh oscili 1, 0.6, giSine
    aChTimeL interp 15+9.0*kCh
    aChTimeR interp 15-9.0*kCh
    aTapL vdelay3 aChInL+aChFbL*0, aChTimeL, 80
    aTapR vdelay3 aChInR+aChFbR*0, aChTimeR, 80
    aChFbL = aTapL
    aChFbR = aTapR
    aL = aL*0.48+aTapL*0.52
    aR = aR*0.48+aTapR*0.52
    aChMid = (aL+aR)*0.5
    aChSide = (aL-aR)*0.5*1
    aL = aChMid+aChSide
    aR = aChMid-aChSide
  endif
  if giStage >= 4 then
    aRoomInL = aL
    aRoomPreL delay aRoomInL, 0.008
    aRoomInR = aR
    aRoomPreR delay aRoomInR, 0.008
    aRoomL, aRoomR reverbsc aRoomPreL, aRoomPreR, 0.8276, 4500, sr, 0.4
    aRoomMid = (aRoomL+aRoomR)*0.5
    aRoomSide = (aRoomL-aRoomR)*0.5*1
    aL = aL*0.5+(aRoomMid+aRoomSide)*0.5
    aR = aR*0.5+(aRoomMid-aRoomSide)*0.5
  endif
  outs aL*giOutputScale, aR*giOutputScale
  clear gaLeft, gaRight
endin
</CsInstruments>
<CsScore>
; p3 held seconds, p4 MIDI pitch, p5 velocity
i 1 0 4 48 0.8
i 1 8 4 55 0.9
i 1 16 4 60 0.72
i 90 0 35
e
</CsScore>
</CsoundSynthesizer>
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/detuned-room-pad/csound/)
