playgrid.ccRead tutorial

Tutorial 040 / Csound

Build Coral Isle in Csound

Build Coral Isle in Csound with modal plucked string synthesis, explicit contours and the sound-shaping chain explained in the guide.

5 stepsModal Plucked StringCsound 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 / 5

Excite a decaying string mode bank

Set giStage init 1 in the full script. Feed a 1.5 ms shaped pulse with a quiet noise component into sixteen string modes. The strike position is 0.28 of string length and the pickup position 0.22. Each mode is weighted by the sine of both positions, so moving the strike changes which harmonics are suppressed. A small stiffness term bends upper partials away from perfect harmonic ratios. The fundamental T60 is 3.4 s and upper modes decay faster. This modal bank interprets Tension rather than implementing its plectrum and string solver.

Csound control Value
Strike / pickup 0.28 / 0.22 of length
Mode frequencies f × n × sqrt(1 + 0.00008 × n²), below 11000 Hz
Decay T60 / (1 + 0.08 × (n−1)^1.3)
Fundamental T60 3.4 s
Exciter lowpass 4300 Hz
String scaling / instrument 0.02 × (0.4 + 0.6 × velocity) / −10 dB

Sound after step 1 — WebM/Opus

Next: Blend body modes and soften the string →

Step 02 / 5

Blend body modes and soften the string

Set giStage init 2 in the full script. Use broad body resonances at 97, 193 and 450 Hz with Q values 8, 12 and 18. Blend 12% of their weighted sum with the string and lowpass at 7300 Hz. The body colors the lower spectrum rather than supplying a sustained oscillator. Natural mode tails continue after the short excitation; the script holds their state for twice the fundamental T60. Body size, damping and pickup geometry are represented by these explicit choices, not a numerical conversion of all Tension macros.

Csound control Value
Body modes 97/193/450 Hz; Q 8/12/18
Body weights / scale 0.4/0.2/0.1 × 0.04
Body mix 12%
Lowpass 7300 Hz

Sound after step 2 — WebM/Opus

Next: Round the signal with saturation →

Step 03 / 5

Round the signal with saturation

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

Sound after step 3 — WebM/Opus

Next: Surround the tone with a damped room →

Step 04 / 5

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.5292, 4500 Hz damping and 12% 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.1 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.1 s (not a measured Csound decay)
Predelay / feedback 12 ms / 0.5292
Damping / wet 4500 Hz / 12%
Room side multiplier 1
Room input cuts Off

Sound after step 4 — WebM/Opus

Next: Set the final width and gain →

Step 05 / 5

Set the final width and gain

Set giStage init 5 in the full script. Use 23.1 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 23.1 dB
Width 1 × side
Bass side cutoff Off
DC removal Order 2048

Sound after step 5 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full Csound script

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

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

giStage init 5
giOutputScale init 0.2452822
giSine ftgen 0, 0, 16384, 10, 1
gaLeft init 0
gaRight init 0
opcode StringModes, a, aiiii
  aExc, iHz, iT60, iPos, iN xin
  iF = iHz*iN*sqrt(1+0.00008*iN*iN)
  aSum init 0
  if iN <= 16 && iF < 11000 then
    iDecay = iT60/(1+0.08*(iN-1)^1.3)
    iQ = 3.14159265*iF*iDecay/log(1000)
    iWeight = sin(3.14159265*iN*iPos)*sin(3.14159265*iN*0.22)/iN
    aMode mode aExc, iF, iQ
    aRest StringModes aExc, iHz, iT60, iPos, iN+1
    aSum = aMode*iWeight+aRest
  endif
  xout aSum
endop
instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  xtratim 6.800000000000001
  aGate linseg 0,0.0003,1,0.0012,0,1,0
  aNoise rand 1
  aExc tone aGate*(0.8+0.2*aNoise), 4300.0
  aString StringModes aExc, iHz, 3.4000000000000004, 0.28, 1
  aString = aString*0.02*(0.4+0.6*iVelocity)*ampdb(-10)
  aL = aString
  aR = aString
  if giStage >= 2 then
    aBody1 mode aString, 97,8
    aBody2 mode aString,193,12
    aBody3 mode aString,450,18
    aBody = (aBody1*0.4+aBody2*0.2+aBody3*0.1)*0.04
    aL = aString*0.88+aBody*0.12
    aL butterlp aL,7300.0
    aR = aL
  endif
  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(1.0))/3
    aL = (aCleanL*0.7+aShapeL*0.3)*ampdb(-1.0)
    aCleanR dcblock2 aR, 2048
    aShapeR = tanh(aCleanR*3*ampdb(1.0))/3
    aR = (aCleanR*0.7+aShapeR*0.3)*ampdb(-1.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.5292, 4500.0, sr, 0.4
    aRoomMid = (aRoomL+aRoomR)*0.5
    aRoomSide = (aRoomL-aRoomR)*0.5*1
    aL = aL*0.88+(aRoomMid+aRoomSide)*0.12
    aR = aR*0.88+(aRoomMid-aRoomSide)*0.12
  endif
  if giStage >= 5 then
    aEndMid = (aL+aR)*0.5
    aEndSide = (aL-aR)*0.5*1.0
    aL = (aEndMid+aEndSide)*ampdb(23.1)
    aL dcblock2 aL, 2048
    aR = (aEndMid-aEndSide)*ampdb(23.1)
    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.8
e
</CsScore>
</CsoundSynthesizer>