playgrid.ccRead tutorial

Tutorial 036 / Csound

Build Copper Circuit in Csound

Build Copper Circuit in Csound with saw and pulse oscillators, a driven resonant ladder filter, slow cutoff movement and mono saturation.

4 stepsResonant BassCsound 6

Listen to the finished sound

Download WEBM ↓

Follow the synthesis steps in order. Use the audio examples and device settings alongside the instructions.

Step 01 / 4

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.

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.

Sound after step 1 — WebM/Opus

Next: Blend a pulse and animate the resonant filter →

Step 02 / 4

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.

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.

Sound after step 2 — WebM/Opus

Next: Drive the bass with rounded saturation →

Step 03 / 4

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.

Sound after step 3 — WebM/Opus

Next: Finish with mono output and DC removal →

Step 04 / 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.

Sound after step 4 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

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.

<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>