# Build Ochre Tines in Csound

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

Ochre Tines in Csound follows the sound-shaping ideas of the [Ableton Electric version](/tutorials/ochre-tines/), 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 — Strike the tone-bar modes

Set `giStage init 1` in the full script. A hammer pulse rises in 0.3 ms and then falls over 0.0014 seconds. Add 10% contact noise and lowpass the excitation at 5520 Hz, with velocity darkening gentler strikes. Modes at ratios 1 and 2.01 decay over 2.8 and 1.8 seconds. The contact duration and bandwidth give the two electric-key sounds different attacks. These resonances interpret Electric's tone bar and hammer rather than simulate its complete mechanics.

| Csound control | Value |
| --- | --- |
| Mode ratios / weights | 1 / 2.01; weights 0.75 / 0.18 |
| Modal T60 | 2.8 / 1.8 s |
| Strike bandwidth | 5520 × (0.5 + 0.5 × velocity) Hz |
| Modal scale | 0.02 |
| Instrument / touch | −12 dB / velocity^1.6 |

<audio controls preload="none" aria-label="Csound Ochre Tines 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 the brighter tine and pickup response

Set `giStage init 2` in the full script. Add modes near ratios 6.98 and 10.03 with 1.36 s and 0.7 s decays. Weight them 0.45 and 0.15, then multiply by the tine blend 0.48. They put a brief bell-like edge above the tone bar. A velocity-dependent tanh curve interprets pickup nonlinearity before the shared effects. Pickup distance, symmetry, damping and release macros are not directly modeled; the script specifies its own contact, resonance and tail behavior.

| Csound control | Value |
| --- | --- |
| Tine ratios / decays | 6.98 / 10.03; 1.36 / 0.70 s |
| Tine blend | 0.48 |
| Pickup curve | tanh(tone × (1 + 2 × velocity)) / (1 + 2 × velocity) |
| Tail lifetime | 6 s beyond held duration |

<audio controls preload="none" aria-label="Csound Ochre Tines 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 +2 dB drive with 45% shaped signal and -2 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 | 2 / -2 dB |
| Shaped mix | 45% |
| Input DC removal | Order 2048 |

<audio controls preload="none" aria-label="Csound Ochre Tines 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 tone with a damped room

Set `giStage init 4` in the full script. Feed the preceding signal through 12 ms predelay into `reverbsc`, with feedback 0.5954, 4500 Hz damping and 14% wet mix. Predelay leaves the initial articulation in front; feedback prolongs the tail, while damping darkens repeated circulation. The source room decay setting is 1.35 seconds, but Csound feedback is not a decay-time control: this is an interpretation of that space, with different diffusion and modulation. 

| Csound control | Value |
| --- | --- |
| Source decay target | 1.35 s (not a measured Csound decay) |
| Predelay / feedback | 12 ms / 0.5954 |
| Damping / wet | 4500 Hz / 14% |
| Room side multiplier | 1 |
| Room input cuts | Off |

<audio controls preload="none" aria-label="Csound Ochre Tines 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 — Set the final width and gain

Set `giStage init 5` in the full script. Use -2.99 dB gain after the effects. Scale the side signal by 1, preserving the center. Apply order-2048 DC removal, using a longer window to limit low-note loss. The fixed output-scale control at the end of instrument 90 remains a separate Csound gain setting. Clear the shared note buses only after processing them; effect memories continue carrying their own tails.

| Csound control | Value |
| --- | --- |
| Final gain | -2.99 dB |
| Width | 1 × side |
| Bass side cutoff | Off |
| DC removal | Order 2048 |

<audio controls preload="none" aria-label="Csound Ochre Tines 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/ochre-tines.webm) · [Complete settings](ALL_PARAMETERS.md) · [Ableton version](/tutorials/ochre-tines/)

## Full Csound script

This document contains the complete Ochre Tines source, shared effects and example score. `giStage` selects the cumulative stages from 1 to 5; 5 is the finished sound.

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

giStage init 5
giOutputScale init 6.200163
giSine ftgen 0, 0, 16384, 10, 1
gaLeft init 0
gaRight init 0

instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  xtratim 6
  aHit linseg 0,0.0003,1,0.0014,0,1,0
  aNoise rand 1
  aExc tone aHit*(1+0.1*aNoise), 5520.0*(0.5+0.5*iVelocity)
  aTone1 mode aExc,iHz,3.14159265*iHz*2.8/log(1000)
  aTone2 mode aExc,min(11000,iHz*2.01),3.14159265*min(11000,iHz*2.01)*1.8/log(1000)
  aTone = (aTone1*0.75+aTone2*0.18)*0.02
  if giStage >= 2 then
    aTine1 mode aExc,min(11000,iHz*6.98),3.14159265*min(11000,iHz*6.98)*1.36/log(1000)
    aTine2 mode aExc,min(11000,iHz*10.03),3.14159265*min(11000,iHz*10.03)*0.7/log(1000)
    aTone = aTone+(aTine1*0.45+aTine2*0.15)*0.02*0.48
  endif
  aTone = tanh(aTone*(1+2*iVelocity))/(1+2*iVelocity)
  aL = aTone*ampdb(-12)*iVelocity^1.6
  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(2.0))/3
    aL = (aCleanL*0.55+aShapeL*0.45)*ampdb(-2.0)
    aCleanR dcblock2 aR, 2048
    aShapeR = tanh(aCleanR*3*ampdb(2.0))/3
    aR = (aCleanR*0.55+aShapeR*0.45)*ampdb(-2.0)
  endif
  if giStage >= 4 then
    aRoomInL = aL
    aRoomPreL delay aRoomInL, 0.012
    aRoomInR = aR
    aRoomPreR delay aRoomInR, 0.012
    aRoomL, aRoomR reverbsc aRoomPreL, aRoomPreR, 0.5954, 4500.0, sr, 0.4
    aRoomMid = (aRoomL+aRoomR)*0.5
    aRoomSide = (aRoomL-aRoomR)*0.5*1
    aL = aL*0.86+(aRoomMid+aRoomSide)*0.14
    aR = aR*0.86+(aRoomMid-aRoomSide)*0.14
  endif
  if giStage >= 5 then
    aEndMid = (aL+aR)*0.5
    aEndSide = (aL-aR)*0.5*1.0
    aL = (aEndMid+aEndSide)*ampdb(-2.99)
    aL dcblock2 aL, 2048
    aR = (aEndMid-aEndSide)*ampdb(-2.99)
    aR dcblock2 aR, 2048
  endif
  outs aL*giOutputScale, aR*giOutputScale
  clear gaLeft, gaRight
endin
</CsInstruments>
<CsScore>
; p3 held seconds, p4 MIDI pitch, p5 velocity
i 1 0 1 48 0.75
i 1 4 1 60 0.9
i 1 8 1 64 0.8
i 90 0 25
e
</CsScore>
</CsoundSynthesizer>
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/ochre-tines/csound/)
