# Build Smoke Veil in Csound

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

Smoke Veil in Csound follows the sound-shaping ideas of the [Ableton Analog version](/tutorials/smoke-veil/), 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 — Build the first oscillator and touch contour

Set `giStage init 1` in the full script. Use rect at -7 dB with pulse width 25% when applicable. The contour has 0.005 s attack, 2.08 s exponential decay to 0.15 sustain and 0.572 s release. Multiply by velocity^2; this explicit power curve interprets the source velocity response. Keep the signal centered before adding effects.

| Csound control | Value |
| --- | --- |
| Source | Rect, -7.0 dB; width 25 % |
| Amplitude A/D/S/R | 0.005 / 2.08 / 0.15 / 0.572 |
| Amplifier / instrument | -6.0 dB / -7.0 dB |
| Velocity power | 2.0 |

<audio controls preload="none" aria-label="Csound Smoke Veil 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 second oscillator and resonant contour

Set `giStage init 2` in the full script. Add sine at -22 dB, tuned by 1 octaves. Use a Low-pass 24dB/oct interpretation with 868 Hz base cutoff, 2.3 octave envelope depth and 0.7 octave-per-octave pitch tracking. The contour opens then settles quickly while the amplitude remains. Smooth input drive interprets Sym1; the ladder or second-order lowpass is a different circuit. The 0 Hz LFO, where enabled, restarts per score note rather than running freely.

| Csound control | Value |
| --- | --- |
| Second source | Sine; -22 dB; width not used |
| Filter base / resonance | 868 Hz / 0.16 |
| Filter A/D/S/R | 0.005 / 0.32 / 0.08 / 0.25 |
| Envelope / key / LFO depth | 2.3 / 0.7 / 0 octaves |
| LFO rate | 0 Hz |
| Filter input shape | tanh(input × 1.4) / 1.4 |

<audio controls preload="none" aria-label="Csound Smoke Veil 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 12 ms by ±2.4 ms at 0.44 Hz, with opposite phases and 18% wet mix. Highpass only the wet inputs at 180 Hz to leave the direct low body clear. 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 | 12 / ±2.4 ms |
| Rate / wet | 0.44 Hz / 18% |
| Wet highpass | 180 Hz |
| Width / feedback | 1 / 0 |
| Warmth shaping | 0% smooth-drive interpretation |

<audio controls preload="none" aria-label="Csound Smoke Veil 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 12 ms predelay into `reverbsc`, with feedback 0.6984, 4500 Hz damping and 17% 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.95 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.95 s (not a measured Csound decay) |
| Predelay / feedback | 12 ms / 0.6984 |
| Damping / wet | 4500 Hz / 17% |
| Room side multiplier | 1 |
| Room input cuts | Off |

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

## Step 5 — Set the final width and gain

Set `giStage init 5` in the full script. Use 2.31 dB gain after the effects. Scale the side signal by 1, preserving the center. 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 | 2.31 dB |
| Width | 1 × side |
| Bass side cutoff | Off |
| DC removal | Order 2048 |

<audio controls preload="none" aria-label="Csound Smoke Veil after step 5"><source src="audio/steps/step-05.webm" type="audio/webm"></audio>

[Sound after step 5 — WebM/Opus](audio/steps/step-05.webm)

## Downloads and settings

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

## Full Csound script

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

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

giStage init 5
giOutputScale init 1.898912
giSine ftgen 0, 0, 16384, 10, 1
gaLeft init 0
gaRight init 0

instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  aSource vco2 ampdb(-7.0), iHz, 2, 0.25, 0
  if giStage >= 2 then
  aSecond oscili ampdb(-22.0), iHz*pow(2,1.0+0/1200), giSine, 0
  aSource = aSource+aSecond
  kFilterGate linseg 0, 0.005, 1, 1, 1
  kFilterDecay expsegr 1, 0.005, 1, 0.32, 0.08, 0.25, 0.000001
  kFilter = kFilterGate*kFilterDecay
  kLFO oscili 1, 0, giSine
  kCut = limit(868.0*pow(2,2.3*kFilter+0.7*(p4-60)/12+0*kLFO),30,18000)
  aSource = tanh(aSource*1.4)/1.4
  aSource moogladder aSource, kCut, 0.16
  endif
  aAmpGate linseg 0, 0.005, 1, 1, 1
  aAmpDecay expsegr 1, 0.005, 1, 2.08, 0.15, 0.572, 0.000001
  aAmp = aAmpGate*aAmpDecay
  aL = aSource*aAmp*ampdb(-13.0)*iVelocity^2.0
  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 butterhp aL, 180.0
    aChInR butterhp aR, 180.0
    kCh oscili 1, 0.44, giSine
    aChTimeL interp 12+2.4000000000000004*kCh
    aChTimeR interp 12-2.4000000000000004*kCh
    aTapL vdelay3 aChInL+aChFbL*0, aChTimeL, 80
    aTapR vdelay3 aChInR+aChFbR*0, aChTimeR, 80
    aChFbL = aTapL
    aChFbR = aTapR
    aL = aL*0.8200000000000001+aTapL*0.18
    aR = aR*0.8200000000000001+aTapR*0.18
    aChMid = (aL+aR)*0.5
    aChSide = (aL-aR)*0.5*1.0
    aL = aChMid+aChSide
    aR = aChMid-aChSide
  endif
  if giStage >= 4 then
    aRoomInL = aL
    aRoomPreL delay aRoomInL, 0.012
    aRoomInR = aR
    aRoomPreR delay aRoomInR, 0.012
    aRoomL, aRoomR reverbsc aRoomPreL, aRoomPreR, 0.6984, 4500.0, sr, 0.4
    aRoomMid = (aRoomL+aRoomR)*0.5
    aRoomSide = (aRoomL-aRoomR)*0.5*1
    aL = aL*0.83+(aRoomMid+aRoomSide)*0.17
    aR = aR*0.83+(aRoomMid-aRoomSide)*0.17
  endif
  if giStage >= 5 then
    aEndMid = (aL+aR)*0.5
    aEndSide = (aL-aR)*0.5*1.0
    aL = (aEndMid+aEndSide)*ampdb(2.31)
    aL dcblock2 aL, 2048
    aR = (aEndMid-aEndSide)*ampdb(2.31)
    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.5 48 0.8
i 1 3.072 1.5 55 0.9
i 1 6.144 1.5 60 0.72
i 90 0 20.216
e
</CsScore>
</CsoundSynthesizer>
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/smoke-veil/csound/)
