# Build Flint Snap in Csound

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

Flint Snap in Csound follows the sound-shaping ideas of the [Ableton Operator version](/tutorials/flint-snap/), 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 — Shape the sine body

Set `giStage init 1` in the full script. Use a retriggered sine at -8.0 dB, transposed 0 semitones. Attack is 0.0003 seconds, exponential decay 0.11 seconds, sustain 0 and release 0.08 seconds. Positive exponential floors stand in for silence. The contour starts again for each score note; it differs from Operator's Trigger envelope behavior on very short held notes.

| Csound control | Value |
| --- | --- |
| Carrier | Sine, phase 0 |
| Amplitude A/D/S/R | 0.0003 / 0.11 / 0 / 0.08 |
| Instrument gain | -12 dB |
| Transpose | 0 st |

<audio controls preload="none" aria-label="Csound Flint Snap 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 — Build the characteristic spectrum

Set `giStage init 2` in the full script. Add a separately decaying white-noise layer at −5 dB with 190 ms decay and 100 ms release. Highpass the combined body at 160 Hz, leaving a pitched knock underneath the noise snap. The exact source circuit and low-level envelope behavior are represented by the explicit code in the full script.

| Csound control | Value |
| --- | --- |
| Added source / motion | White noise: −5 dB; 190 ms decay |
| Filter | 160 Hz |
| Filter type | Highpass |

<audio controls preload="none" aria-label="Csound Flint Snap 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 +3 dB drive with 60% 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 | 3 / -2 dB |
| Shaped mix | 60% |
| Input DC removal | Order 2048 |

<audio controls preload="none" aria-label="Csound Flint Snap 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 5 ms predelay into `reverbsc`, with feedback 0.35, 4500 Hz damping and 9% wet mix. Predelay leaves the initial articulation in front; feedback prolongs the tail, while damping darkens repeated circulation. The source room decay setting is 0.45 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 | 0.45 s (not a measured Csound decay) |
| Predelay / feedback | 5 ms / 0.35 |
| Damping / wet | 4500 Hz / 9% |
| Room side multiplier | 1 |
| Room input cuts | Off |

<audio controls preload="none" aria-label="Csound Flint Snap 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 -0.77 dB gain after the effects. Average the channels for identical mono outputs. 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 | -0.77 dB |
| Width | Mono |
| Bass side cutoff | Off |
| DC removal | Order 2048 |

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

## Full Csound script

This document contains the complete Flint Snap 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 1.119335
giSine ftgen 0, 0, 16384, 10, 1
gaLeft init 0
gaRight init 0

instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  kPitch = 0
  kHz = iHz*pow(2,(0.0+kPitch)/12)
  aSource oscili ampdb(-8.0), kHz, giSine, 0
  aAmpGate linseg 0, 0.0003, 1, 1, 1
  aAmpDecay expsegr 1, 0.0003, 1, 0.11, 1e-06, 0.08, 0.000001
  aAmp = aAmpGate*aAmpDecay
  aSource = aSource*aAmp
  if giStage >= 2 then
  aNoise rand ampdb(-5)
  aNoiseEnvGate linseg 0, 0.0005, 1, 1, 1
  aNoiseEnvDecay expsegr 1, 0.0005, 1, 0.19, 1e-06, 0.1, 0.000001
  aNoiseEnv = aNoiseEnvGate*aNoiseEnvDecay
  aSource = aSource+aNoise*aNoiseEnv
  aSource butterhp aSource,160
  endif
  aL = aSource*ampdb(-12.0)*(0.4+0.6*iVelocity)
  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(3.0))/3
    aL = (aCleanL*0.4+aShapeL*0.6)*ampdb(-2.0)
    aCleanR dcblock2 aR, 2048
    aShapeR = tanh(aCleanR*3*ampdb(3.0))/3
    aR = (aCleanR*0.4+aShapeR*0.6)*ampdb(-2.0)
  endif
  if giStage >= 4 then
    aRoomInL = aL
    aRoomPreL delay aRoomInL, 0.005
    aRoomInR = aR
    aRoomPreR delay aRoomInR, 0.005
    aRoomL, aRoomR reverbsc aRoomPreL, aRoomPreR, 0.35, 4500.0, sr, 0.4
    aRoomMid = (aRoomL+aRoomR)*0.5
    aRoomSide = (aRoomL-aRoomR)*0.5*1
    aL = aL*0.91+(aRoomMid+aRoomSide)*0.09
    aR = aR*0.91+(aRoomMid-aRoomSide)*0.09
  endif
  if giStage >= 5 then
    aEndMid = (aL+aR)*0.5
    aEndSide = (aL-aR)*0.5*0
    aL = (aEndMid+aEndSide)*ampdb(-0.77)
    aL dcblock2 aL, 2048
    aR = (aEndMid-aEndSide)*ampdb(-0.77)
    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 0.7 60 0.8
i 1 1.6 0.7 64 0.95
i 1 3.2 0.7 67 0.7
i 90 0 14
e
</CsScore>
</CsoundSynthesizer>
```

[Read on playgrid.cc](https://playgrid.cc/tutorials/flint-snap/csound/)
