# Build Willow Arc in Csound

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

Willow Arc in Csound follows the sound-shaping ideas of the [Ableton Drift version](/tutorials/willow-arc/), 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 — Shape the drifting bass body

Set `giStage init 1` in the full script. Use triangle at -10 dB, with ±0.4 cents of slow note-local pitch drift. Set attack 0.00987 s, decay 0.687 s, sustain 0.85 and release 0.144 s. Keep the source centered. This replaces Drift's irregular oscillator instability with a small sine drift; glide and mono note-priority are not implemented.

| Csound control | Value |
| --- | --- |
| Wave / gain | Triangle / -10 dB |
| Amplitude A/D/S/R | 0.00987 / 0.687 / 0.85 / 0.144 |
| Instrument / velocity | -8.0 dB / 45 % |
| Drift | ±0.4 cents at 0.19 Hz |

<audio controls preload="none" aria-label="Csound Willow Arc 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 sub and lowpass movement

Set `giStage init 2` in the full script. Add an octave-down sine at -6.0 dB. Route both sources through a 151 Hz ladder lowpass with 0.12 resonance, followed by the 24 Hz highpass. The second envelope moves cutoff by 0.36 octaves; keyboard and velocity amounts add their own opening. The filter type and modulation scaling interpret the source rather than copy its Type II circuit.

| Csound control | Value |
| --- | --- |
| Sub | Octave down, -6.0 dB |
| Cutoff / resonance | 151 Hz / 0.12 |
| Filter A/D/S/R | 0.004 / 0.38 / 0.15 / 0.16 |
| Envelope / key / velocity depth | 0.36 / 0.7 / 0.16 octaves |

<audio controls preload="none" aria-label="Csound Willow Arc 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 — Round the signal with saturation

Set `giStage init 3` in the full script. Use +2.8 dB drive with 55% shaped signal and -2 dB output trim. The smooth curve is `tanh(input × 3 × ampdb(drive)) / 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.

| Csound control | Value |
| --- | --- |
| Drive / output | 2.8 / -2 dB |
| Shaped mix | 55% |
| Input DC removal | Order 2048 |

<audio controls preload="none" aria-label="Csound Willow Arc 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 7.43 dB gain after the effects. Average the channels for identical mono outputs. 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 | 7.43 dB |
| Width | Mono |
| Bass side cutoff | Off |
| DC removal | Order 2048 |

<audio controls preload="none" aria-label="Csound Willow Arc 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/willow-arc.webm) · [Complete settings](ALL_PARAMETERS.md) · [Ableton version](/tutorials/willow-arc/)

## Full Csound script

This document contains the complete Willow Arc 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.4866619
giSine ftgen 0, 0, 16384, 10, 1
gaLeft init 0
gaRight init 0

instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  kDrift oscili 0.4, 0.19, giSine
  kHz = iHz*pow(2,kDrift/1200)
  aSource vco2 ampdb(-10.0), kHz, 12, 0.5, 0
  if giStage >= 2 then
  aSub oscili ampdb(-6.0), kHz*0.5, giSine, 0
  aSource = aSource+aSub
  kFilter linsegr 0, 0.004, 1, 0.38, 0.15, 0.16, 0
  kCut = limit(151.0*pow(2,0.36*kFilter+0.7*(p4-60)/12+0.16*iVelocity),30,18000)
  aSource moogladder aSource,kCut,0.12
  aSource butterhp aSource,24.0
  endif
  kAmp linsegr 0, 0.009869999999999999, 1, 0.687, 0.85, 0.144, 0
  aL = aSource*kAmp*ampdb(-8.0)*(0.55+0.45*iVelocity)
  aR = aL
  gaLeft = gaLeft+aL
  gaRight = gaRight+aR
endin
instr 90
  aL = gaLeft
  aR = gaRight
  if giStage >= 3 then
    aCleanL dcblock2 aL, 2048
    aShapeL = tanh(aCleanL*3*ampdb(2.8))/3
    aL = (aCleanL*0.44999999999999996+aShapeL*0.55)*ampdb(-2.0)
    aCleanR dcblock2 aR, 2048
    aShapeR = tanh(aCleanR*3*ampdb(2.8))/3
    aR = (aCleanR*0.44999999999999996+aShapeR*0.55)*ampdb(-2.0)
  endif
  if giStage >= 4 then
    aEndMid = (aL+aR)*0.5
    aEndSide = (aL-aR)*0.5*0
    aL = (aEndMid+aEndSide)*ampdb(7.43)
    aL dcblock2 aL, 2048
    aR = (aEndMid-aEndSide)*ampdb(7.43)
    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 0.8 36 0.85
i 1 1.5 0.8 43 0.95
i 1 3 0.8 40 0.8
i 90 0 7.96
e
</CsScore>
</CsoundSynthesizer>
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/willow-arc/csound/)
