# Build Alder Well in Csound

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

Alder Well is a pitched percussion sound with a brief FM edge, a decaying sine body and a small stereo room. This version interprets the [Ableton Operator sound](/tutorials/alder-well/) with explicit oscillators and effects.

Signal flow: **sine carrier ← short sine modulator → lowpass → soft saturation → stereo room → output gain and DC removal**.

[Starting settings](STARTING_STATE.md) · [Complete settings](ALL_PARAMETERS.md). The full Csound script appears at the end of this guide.

## Step 1 — Build the sine body and touch response

Begin with instrument 1 and the shared output instrument 90 from the full script. Set `giStage init 1` for the carrier alone. `giSine` contains one sine cycle; the carrier starts at phase zero for a repeatable attack.

```csound
aAttack linseg 0, 0.001, 1, 1, 1
aBody expsegr 1, 1.10, 0.0001, 0.350, 0.000001
aAmplitude = aAttack * aBody * ampdb(-3) * ampdb(-10)
aAmplitude = aAmplitude * (0.4 + 0.6*iVelocity)
```

The attack gate reaches full level in 1 ms. The exponential body falls to a near-silent floor over 1.10 seconds; releasing a held note starts a 350 ms fade from its current value. The floors are positive because exponential segments cannot end at zero. These curves interpret Operator's envelope rather than duplicate its internal shape.

Carrier gain is −3 dB before a −10 dB instrument gain. Velocity scales level by `0.4 + 0.6 × velocity`, so gentler strikes remain audible. The source is centered; stereo space arrives later.

<audio controls preload="none" aria-label="Csound Alder Well 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 a short FM edge and tracked lowpass

Set `giStage init 2`. Feed a second sine oscillator into the carrier's instantaneous frequency. This is a two-oscillator serial path: the modulator is not mixed directly into the output.

```csound
iRatio = 3.051
iIndex = 8 * ampdb(-12) * (0.3 + 0.7*iVelocity)
aModEnvelope expsegr 1, 0.172, 0.0001, 0.100, 0.000001
aModulator oscili iHz*iRatio*iIndex*aModEnvelope, iHz*iRatio, giSine, 0
aCarrier oscili aAmplitude, iHz+aModulator, giSine, 0
```

A ratio just above 3:1 gives the strike a slightly inharmonic edge. The 172 ms modulator decay removes the bright sidebands much sooner than the body fades. Modulator velocity response uses `0.3 + 0.7 × velocity`: stronger strikes raise brightness as well as volume. The factor 8 translates the source's −12 dB modulator level into a Csound FM index; it is an interpretation, not a universal conversion for Operator levels. The explicit ratio approximates the source's Coarse 3 / Fine 17 setting.

Pass the result through `butterlp` at `5330 × 2^(0.6 × (MIDI note − 60) / 12)` Hz, limited to 30–18000 Hz. This gives 60% pitch tracking around MIDI 60. It is a clean 12 dB/octave lowpass; the source's small resonance and Tone control are not modeled separately. No pitch sweep or LFO is added.

<audio controls preload="none" aria-label="Csound Alder Well 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 transient with soft saturation

Set `giStage init 3`. Process the combined note bus through DC removal and a smooth saturation curve before the room. The shared bus lets overlapping notes drive the curve together.

```csound
aClean dcblock2 aDry
aDriven = tanh(aClean*3*ampdb(1.2))/3
aDry = (aClean*0.60 + aDriven*0.40)*ampdb(-1)
```

Drive is +1.2 dB and the processed share is 40%. The factor 3 sets the curve's sensitivity; division by 3 preserves small-signal gain before the drive boost. The −1 dB output trim balances the result. Harder strikes round more strongly while soft strikes stay close to a sine. This tanh curve interprets the gentle Soft Sine color; it does not implement Ableton's proprietary transfer curve.

<audio controls preload="none" aria-label="Csound Alder Well 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 strike with a short stereo room

Set `giStage init 4`. Delay the room input by 8 ms, then use the shared `reverbsc` output at 15% wet.

```csound
aPre delay aDry, 0.008
aRoomL, aRoomR reverbsc aPre, aPre, 0.68, 4500, sr, 0.35
aLeft = aDry*0.85 + aRoomL*0.15
aRight = aDry*0.85 + aRoomR*0.15
```

The predelay lets the strike arrive before the room. Feedback 0.68 produces a short room-like tail, while 4500 Hz damping darkens its upper frequencies. Delay modulation depth 0.35 keeps the tail from sounding completely static. The centered source feeds both reverb inputs; the reverb generates the stereo difference.

The Ableton room's 1.29-second decay, size and diffusion have no direct numerical equivalent here. Feedback and damping approximate its role around the short FM tone; they are not a claim of identical decay time.

<audio controls preload="none" aria-label="Csound Alder Well 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 — Apply the final output trim and DC removal

Set `giStage init 5` for the finished sound. Keep the room's stereo difference and trim both channels by −2.77 dB.

```csound
aLeft dcblock2 aLeft*ampdb(-2.77)
aRight dcblock2 aRight*ampdb(-2.77)
outs aLeft, aRight
clear gaVoice
```

DC removal follows the nonlinear stage and room. There is no bass-mono or extra width process in this sound. Clear the shared note bus after each control block so only the current note samples feed the next pass. The result has an initial bright knock, a quieter pitched body and a short stereo tail.

<audio controls preload="none" aria-label="Csound Alder Well 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/alder-well.webm) · [Complete settings](ALL_PARAMETERS.md) · [Ableton implementation](/tutorials/alder-well/)

## Full Csound script

This complete Csound document contains the sine carrier, short FM modulator, lowpass, gentle saturation and shared stereo room. Instrument 1 takes held duration in p3, MIDI pitch in p4 and velocity from 0 to 1 in p5. Instrument 90 processes all notes together and stays active through their reverb tails. `giStage` selects the cumulative sound stage; 5 is the finished instrument.

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

giStage init 5
giSine ftgen 0, 0, 16384, 10, 1
gaVoice init 0

instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  ; The 1 ms gate softens the sine start; the decay reaches a quiet floor.
  aAttack linseg 0, 0.001, 1, 1, 1
  aBody expsegr 1, 1.10, 0.0001, 0.350, 0.000001
  aAmplitude = aAttack * aBody * ampdb(-3) * ampdb(-10)
  aAmplitude = aAmplitude * (0.4 + 0.6*iVelocity)

  ; A short near-third-harmonic modulator adds the struck upper edge.
  aModulator init 0
  if giStage >= 2 then
    iRatio = 3.051
    iIndex = 8 * ampdb(-12) * (0.3 + 0.7*iVelocity)
    aModEnvelope expsegr 1, 0.172, 0.0001, 0.100, 0.000001
    aModulator oscili iHz*iRatio*iIndex*aModEnvelope, iHz*iRatio, giSine, 0
  endif
  aCarrier oscili aAmplitude, iHz+aModulator, giSine, 0
  aVoice = aCarrier
  if giStage >= 2 then
    kCutoff = limit(5330 * pow(2, 0.6*(p4-60)/12), 30, 18000)
    aVoice butterlp aCarrier, kCutoff
  endif
  gaVoice = gaVoice + aVoice
endin

instr 90
  aDry = gaVoice
  if giStage >= 3 then
    aClean dcblock2 aDry
    ; A smooth odd-symmetric curve interprets the Soft Sine color.
    aDriven = tanh(aClean*3*ampdb(1.2))/3
    aDry = (aClean*0.60 + aDriven*0.40)*ampdb(-1)
  endif
  aLeft = aDry
  aRight = aDry
  if giStage >= 4 then
    aPre delay aDry, 0.008
    aRoomL, aRoomR reverbsc aPre, aPre, 0.68, 4500, sr, 0.35
    aLeft = aDry*0.85 + aRoomL*0.15
    aRight = aDry*0.85 + aRoomR*0.15
  endif
  if giStage >= 5 then
    aLeft dcblock2 aLeft*ampdb(-2.77)
    aRight dcblock2 aRight*ampdb(-2.77)
  endif
  outs aLeft, aRight
  clear gaVoice
endin
</CsInstruments>
<CsScore>
; Pitch and touch examples: the short modulator decays before the body.
;       start hold MIDI velocity
i 1     0     1.4   48   0.55
i 1     1.9   1.4   60   0.85
i 1     3.8   1.4   67   0.65
i 1     5.7   1.4   72   0.95
i 90    0     10
e
</CsScore>
</CsoundSynthesizer>
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/alder-well/csound/)
