# Build Resonant Pulse Lead in Csound

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

Resonant Pulse Lead in Csound follows the sound-shaping ideas of the [Ableton Analog version](/tutorials/resonant-pulse-lead/), 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 — Combine the two narrow pulses

Set `giStage init 1` in the full script. Use two 25% pulse waves at −6 dB each, with the second two cents flat as an explicit detuning choice. Amplifier and global gains are −6 dB each. The amplitude opens over 8 ms, holds full sustain and releases over 80 ms. The independent score-note model omits the source last-note-priority legato and controller-driven vibrato.

| Csound control | Value |
| --- | --- |
| Pulse pair | Width 0.25 each; −6 dB each; second −2 cents |
| Amplitude | 8 ms attack; full sustain; 80 ms release |
| Amplifier / instrument | −6 / −6 dB |

<audio controls preload="none" aria-label="Csound Resonant Pulse Lead 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 the dark resonant filter briefly

Set `giStage init 2` in the full script. Use a 220 Hz ladder lowpass with resonance 0.40 and full key tracking. A 5 ms / 143 ms / 0.48 / 143 ms exponential contour moves cutoff by 2.6 octaves. Its short brightness change occurs while the amplitude remains held, giving a pronounced articulation on detached notes.

| Csound control | Value |
| --- | --- |
| Cutoff | 220 × 2^(2.6 × envelope + (note−60)/12) Hz |
| Resonance | 0.40 |
| Filter contour | 5 ms / 143 ms / 0.48 / 143 ms |

<audio controls preload="none" aria-label="Csound Resonant Pulse Lead 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 +33 dB drive with 78% shaped signal and -14 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 | 33 / -14 dB |
| Shaped mix | 78% |
| Input DC removal | Order 2048 |

<audio controls preload="none" aria-label="Csound Resonant Pulse Lead 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 — Add slow comb movement and echoes

Set `giStage init 4` in the full script. Sweep opposite delay taps around 1.5 ms by ±0.81 ms at 0.06 Hz. Feedback 78% strengthens the moving comb peaks; 12% wet leaves the lead in front. The explicit short-delay network interprets Phaser-Flanger, with an extra control-block latency in its feedback path. Slowly held notes reveal the sweep. Use 650 ms left and 650 ms right, 21% feedback and 7% wet. Inject the centered input on the left and cross-feed the filtered echoes so later repeats alternate sides. Filter each echo around 632.456 Hz, with a 5.96578-octave interval between highpass and lowpass cutoffs. Feedback values are updated once per 16-sample block, adding that small delay to the recirculating path. Held notes leave older colors behind the current tone.

| Csound control | Value |
| --- | --- |
| Center / depth | 1.5 / ±0.81 ms |
| Rate / feedback / wet | 0.06 Hz / 78% / 12% |
| Times | 650 / 650 ms |
| Feedback / wet | 21% / 7% |
| Routing | Crossed, left input |
| Filter center / width | 632.456 Hz / 5.96578 octaves |
| Time LFO | 0 Hz, ±0% |

<audio controls preload="none" aria-label="Csound Resonant Pulse Lead 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/Resonant-Pulse-Lead.webm) · [Complete settings](ALL_PARAMETERS.md) · [Ableton version](/tutorials/resonant-pulse-lead/)

## Full Csound script

This document contains the complete Resonant Pulse Lead 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 2.04644
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, 2, 0.25, 0
  aB vco2 ampdb(-6), iHz*pow(2,-2/1200), 2, 0.25, 0
  aSource = aA+aB
  if giStage >= 2 then
  kFilterGate linseg 0, 0.005, 1, 1, 1
  kFilterDecay expsegr 1, 0.005, 1, 0.143, 0.48, 0.143, 0.000001
  kFilter = kFilterGate*kFilterDecay
  kCut = limit(220*pow(2,2.6*kFilter+(p4-60)/12),30,18000)
  aSource moogladder aSource,kCut,0.40
  endif
  kAmpGate linseg 0, 0.008, 1, 1, 1
  kAmpDecay expsegr 1, 0.008, 1, 0.08, 1, 0.08, 0.000001
  kAmp = kAmpGate*kAmpDecay
  aL = aSource*kAmp*ampdb(-12)
  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(33))/3
    aL = (aCleanL*0.21999999999999997+aShapeL*0.78)*ampdb(-14)
    aCleanR dcblock2 aR, 2048
    aShapeR = tanh(aCleanR*3*ampdb(33))/3
    aR = (aCleanR*0.21999999999999997+aShapeR*0.78)*ampdb(-14)
  endif
  if giStage >= 4 then
    aFlFbL init 0
    aFlFbR init 0
    kFl oscili 1, 0.06, giSine
    aFlTimeL interp 1.5+0.81*kFl
    aFlTimeR interp 1.5-0.81*kFl
    aFlL vdelay3 aL+aFlFbL*0.78, aFlTimeL, 20
    aFlR vdelay3 aR+aFlFbR*0.78, aFlTimeR, 20
    aFlFbL = aFlL
    aFlFbR = aFlR
    aL = aL*0.88+aFlL*0.12
    aR = aR*0.88+aFlR*0.12

    aDelFbL init 0
    aDelFbR init 0
    kDelMotion = 0
    aDelTimeL interp 650.0*(1+0*kDelMotion)
    aDelTimeR interp 650.0*(1-0*kDelMotion)
    aDelSendL = (aL+aR)*0.5
    aDelSendR = 0
    aEchoL vdelay3 aDelSendL+aDelFbR*0.21, aDelTimeL, 2200
    aEchoR vdelay3 aDelSendR+aDelFbL*0.21, aDelTimeR, 2200
    kDelCenter = 632.4555320336759*pow(2, 0*kDelMotion)
    aEchoL butterhp aEchoL, kDelCenter/pow(2, 2.9828921423310435)
    aEchoL butterlp aEchoL, min(18000,kDelCenter*pow(2, 2.9828921423310435))
    aEchoR butterhp aEchoR, kDelCenter/pow(2, 2.9828921423310435)
    aEchoR butterlp aEchoR, min(18000,kDelCenter*pow(2, 2.9828921423310435))
    aDelFbL = aEchoL
    aDelFbR = aEchoR
    aL = aL*0.9299999999999999+aEchoL*0.07
    aR = aR*0.9299999999999999+aEchoR*0.07
  endif
  outs aL*giOutputScale, aR*giOutputScale
  clear gaLeft, gaRight
endin
</CsInstruments>
<CsScore>
; p3 held seconds, p4 MIDI pitch, p5 velocity
i 1 0 1.2 60 0.8
i 1 3 1.2 67 0.8
i 1 6 1.2 64 0.8
i 90 0 17.343
e
</CsScore>
</CsoundSynthesizer>
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/resonant-pulse-lead/csound/)
