# Build Three Octave Bass in Csound

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

Three Octave Bass in Csound follows the sound-shaping ideas of the [Ableton Operator version](/tutorials/three-octave-bass/), 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 — Stack the three octave saws

Set `giStage init 1` in the full script. Use ratios 0.25, 0.5005 and 1 relative to the played pitch, each at −9.1 dB. These express global transposition −24 st with source ratios 1/2/4. The small middle offset interprets Fine 1. Use a 2 ms attack, full sustain, 44.9 ms release and −15 dB instrument gain.

| Csound control | Value |
| --- | --- |
| Ratios / levels | 0.25 / 0.5005 / 1; −9.1 dB each |
| Amplitude | 2 ms attack, full sustain, 44.9 ms release |
| Instrument | −15 dB |

<audio controls preload="none" aria-label="Csound Three Octave Bass 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 — Drive a tracked closing lowpass

Set `giStage init 2` in the full script. Apply +12 dB smooth input drive and a 24 dB ladder lowpass. Its base is 1000 Hz, with full keyboard tracking, 0.3-octave velocity depth and a 1.44-octave envelope. A 2 ms rise and 2.2 s fall bring the initial brightness toward the darker body. The ladder replaces PRD with its own response.

| Csound control | Value |
| --- | --- |
| Cutoff | 1000 × 2^(1.44 × envelope + (note−60)/12 + 0.3 × velocity) Hz |
| Contour | 2 ms / 2.2 s / zero / 44.9 ms |
| Filter drive / resonance | +12 dB / zero |

<audio controls preload="none" aria-label="Csound Three Octave Bass 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 +12 dB drive with 100% shaped signal and -11 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 | 12 / -11 dB |
| Shaped mix | 100% |
| Input DC removal | Order 2048 |

<audio controls preload="none" aria-label="Csound Three Octave Bass 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)

## Downloads and settings

[Finished sound — WebM/Opus](audio/Three-Octave-Bass.webm) · [Complete settings](ALL_PARAMETERS.md) · [Ableton version](/tutorials/three-octave-bass/)

## Full Csound script

This document contains the complete Three Octave Bass source, shared effects and example score. `giStage` selects the cumulative stages from 1 to 3; 3 is the finished sound.

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

giStage init 3
giOutputScale init 1.74642
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(-9.1),iHz*0.25,0
  aB vco2 ampdb(-9.1),iHz*0.5005,0
  aC vco2 ampdb(-9.1),iHz,0
  aSource = aA+aB+aC
  if giStage >= 2 then
  kFilter linsegr 0, 0.002, 1, 2.2, 0, 0.0449, 0
    kCut = limit(1000*pow(2,1.44*kFilter+(p4-60)/12+0.3*iVelocity),30,18000)
    aDrive = tanh(aSource*ampdb(12))
    aSource moogladder aDrive,kCut,0
  endif
  kAmp linsegr 0, 0.002, 1, 0.5, 1, 0.0449, 0
  aL = aSource*kAmp*ampdb(-15)
  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(12))/3
    aL = (aCleanL*0+aShapeL*1)*ampdb(-11)
    aCleanR dcblock2 aR, 2048
    aShapeR = tanh(aCleanR*3*ampdb(12))/3
    aR = (aCleanR*0+aShapeR*1)*ampdb(-11)
  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 48 0.8
i 1 1.5 0.8 60 0.9
i 1 3 0.8 55 0.65
i 90 0 6.845
e
</CsScore>
</CsoundSynthesizer>
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/three-octave-bass/csound/)
