# Build Copper Circuit in Csound

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

Copper Circuit is a saw-and-pulse bass with a fast resonant opening and smaller continuing filter motion. This version interprets the [Ableton Analog sound](/tutorials/copper-circuit/) with a ladder filter and explicit contour depths.

Signal flow: **saw + 38% pulse → driven resonant ladder filter → amplitude → saturation → mono output**.

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

## Step 1 — Build the centered saw bass

Set `giStage init 1`. Use a band-limited saw at −6 dB and the note's MIDI pitch, with no unison or glide. Keep the source centered.

```csound
aAttack linseg 0, 0.005, 1, 1, 1
aDecay expsegr 1, 0.005, 1, 0.480, 0.65, 0.130, 0.000001
```

Multiply the 5 ms gate by an exponential contour with 480 ms decay, 0.65 sustain and 130 ms release to a quiet positive floor. The decay holds its peak during the opening 5 ms gate. Apply −6 dB amplifier gain and −6 dB instrument gain, then scale by velocity^2.5. That explicit touch curve makes quiet notes substantially softer; it is an interpretation of Analog's response. The example uses separate, non-overlapping notes rather than a mono-legato priority system.

<audio controls preload="none" aria-label="Csound Copper Circuit 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 — Blend a pulse and animate the resonant filter

Set `giStage init 2`. Add a pulse at the same pitch, width 0.38 and gain −12 dB. Both oscillators feed a softly driven 24 dB/octave ladder lowpass.

Build a filter contour with 5 ms attack, 210 ms exponential decay to 0.08 and 130 ms release. Use a 1.7 Hz sine LFO for smaller movement around that contour.

```csound
kCutoff = limit(270*pow(2, 3.20*kFilter+0.50*(p4-60)/12+0.12*kMotion), 30, 18000)
aDrive = tanh(aSource*1.6)/1.6
aSource moogladder aDrive, kCutoff, 0.52
```

The envelope opens the filter by up to 3.20 octaves; tracking adds 0.50 octaves per keyboard octave around MIDI 60. The LFO adds ±0.12 octaves, giving held notes a smaller recurring motion after the initial opening. Resonance 0.52 emphasizes the moving cutoff. The input shaping interprets Sym1 drive; all these mappings use explicit Csound values rather than an exact Analog circuit model. The LFO restarts with each score note in this version.

<audio controls preload="none" aria-label="Csound Copper Circuit 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 — Drive the bass with rounded saturation

Set `giStage init 3`. Remove DC, shape the shared source bus with `tanh(input × 3 × ampdb(4)) / 3`, and blend 70% shaped with 30% clean signal. Apply −3 dB after that blend.

The +4 dB drive adds upper harmonics to the filtered body. Dividing by 3 keeps the transfer curve's small-signal scale before the drive boost. The source curve is Analog Clip; this smooth Csound curve serves the same tone-shaping role with a different transfer function. The clean blend keeps the bass's direct contour audible.

<audio controls preload="none" aria-label="Csound Copper Circuit 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 — Finish with mono output and DC removal

Set `giStage init 4`. Average the two output channels, raise that mono signal by +3.65 dB, and apply `dcblock2` before sending identical samples to both channels.

The source and saturation were already centered, so mono conversion does not newly narrow this particular signal. The audible changes at this stage are the output gain and final DC removal. There are no delay or reverb tails; after the note's 130 ms release, the bass leaves space cleanly. Clear the shared voice bus at the end of the output instrument.

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

## Full Csound script

The complete Copper Circuit instrument and shared effects. `giStage` selects cumulative stages 1–4; 4 is the finished sound. Instrument 1 takes held seconds, MIDI pitch and velocity in p3–p5. Instrument 90 carries the output and any effect tails.

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

giStage init 4
giSine ftgen 0, 0, 16384, 10, 1
gaVoice init 0
instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  aSaw vco2 ampdb(-6), iHz, 0
  aSource = aSaw
  if giStage >= 2 then
    aPulse vco2 ampdb(-12), iHz, 2, 0.38
    aSource = aSource+aPulse
    kAttack linseg 0, 0.005, 1, 1, 1
    kDecay expsegr 1, 0.005, 1, 0.210, 0.08, 0.130, 0.000001
    kFilter = kAttack*kDecay
    kMotion oscili 1, 1.7, giSine
    kCutoff = limit(270*pow(2, 3.20*kFilter+0.50*(p4-60)/12+0.12*kMotion), 30, 18000)
    aDrive = tanh(aSource*1.6)/1.6
    aSource moogladder aDrive, kCutoff, 0.52
  endif
  aAttack linseg 0, 0.005, 1, 1, 1
  aDecay expsegr 1, 0.005, 1, 0.480, 0.65, 0.130, 0.000001
  aAmp = aAttack*aDecay*ampdb(-6)*ampdb(-6)*iVelocity^2.5
  gaVoice = gaVoice+aSource*aAmp
endin
instr 90
  aDry = gaVoice
  if giStage >= 3 then
    aClean dcblock2 aDry, 2048
    aShape = tanh(aClean*3*ampdb(4))/3
    aDry = (aClean*0.30+aShape*0.70)*ampdb(-3)
  endif
  aLeft = aDry
  aRight = aDry
  if giStage >= 4 then
    aMono = (aLeft+aRight)*0.5
    aOut dcblock2 aMono*ampdb(3.65), 2048
    aLeft = aOut
    aRight = aOut
  endif
  outs aLeft, aRight
  clear gaVoice
endin
</CsInstruments>
<CsScore>
i 1 0.0 0.65 36 0.90
i 1 1.1 0.65 31 0.85
i 1 2.2 0.65 33 0.95
i 1 3.3 0.65 40 0.80
i 1 4.4 0.75 36 0.92
i 90 0 7
e
</CsScore>
</CsoundSynthesizer>
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/copper-circuit/csound/)
