playgrid.ccRead tutorial

Tutorial 044 / Csound

Build Ember Thump in Csound

Build Ember Thump in Csound with synth percussion synthesis, explicit contours and the sound-shaping chain explained in the guide.

4 stepsSynth PercussionCsound 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

Shape the sine body

Set giStage init 1 in the full script. Use a retriggered sine at -3.0 dB, transposed -12 semitones. Attack is 0.0005 seconds, exponential decay 0.46 seconds, sustain 0 and release 0.15 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.0005 / 0.46 / 0 / 0.15
Instrument gain -10 dB
Transpose -12 st

Sound after step 1 — WebM/Opus

Next: Build the characteristic spectrum →

Step 02 / 4

Build the characteristic spectrum

Set giStage init 2 in the full script. Add a 24-semitone opening pitch offset that falls to zero over 42 ms, then lowpass at 3200 Hz. The quick drop creates the kick punch while the decaying sine supplies the low body. 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 24 st pitch drop, 42 ms
Filter 3.20 kHz
Filter type Lowpass

Sound after step 2 — WebM/Opus

Next: Round the signal with saturation →

Step 03 / 4

Round the signal with saturation

Set giStage init 3 in the full script. Use +4 dB drive with 75% shaped signal and -3 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 4 / -3 dB
Shaped mix 75%
Input DC removal Order 2048

Sound after step 3 — WebM/Opus

Next: Set the final width and gain →

Step 04 / 4

Set the final width and gain

Set giStage init 4 in the full script. Use 0.25 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.25 dB
Width Mono
Bass side cutoff Off
DC removal Order 2048

Sound after step 4 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full Csound script

This document contains the complete Ember Thump source, shared effects and example score. giStage selects the cumulative stages from 1 to 4; 4 is the finished sound.

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

giStage init 4
giOutputScale init 0.8999323
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
  if giStage >= 2 then
  kPitch linseg 24,0.042,0,1,0
  endif
  kHz = iHz*pow(2,(-12.0+kPitch)/12)
  aSource oscili ampdb(-3.0), kHz, giSine, 0
  aAmpGate linseg 0, 0.0005, 1, 1, 1
  aAmpDecay expsegr 1, 0.0005, 1, 0.46, 1e-06, 0.15, 0.000001
  aAmp = aAmpGate*aAmpDecay
  aSource = aSource*aAmp
  if giStage >= 2 then
  aSource butterlp aSource,3200
  endif
  aL = aSource*ampdb(-10.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(4.0))/3
    aL = (aCleanL*0.25+aShapeL*0.75)*ampdb(-3.0)
    aCleanR dcblock2 aR, 2048
    aShapeR = tanh(aCleanR*3*ampdb(4.0))/3
    aR = (aCleanR*0.25+aShapeR*0.75)*ampdb(-3.0)
  endif
  if giStage >= 4 then
    aEndMid = (aL+aR)*0.5
    aEndSide = (aL-aR)*0.5*0
    aL = (aEndMid+aEndSide)*ampdb(0.25)
    aL dcblock2 aL, 2048
    aR = (aEndMid-aEndSide)*ampdb(0.25)
    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 48 0.8
i 1 1.6 0.7 48 0.95
i 1 3.2 0.7 55 0.7
i 90 0 14.05
e
</CsScore>
</CsoundSynthesizer>