playgrid.ccRead tutorial

Tutorial 115 / Csound

Build Quartz Ripple in Csound

Build Quartz Ripple in Csound with triangle swarm synthesis, explicit contours and the sound-shaping chain explained in the guide.

5 stepsTriangle SwarmCsound 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

Build the drifting triangle cluster

Set giStage init 1 in the full script. Use five triangle voices spread across ±12 cents, with independent sine drift of ±1.2 cents. Their different phases and slow rates make the held spectrum beat. Use engine gain −10 dB, amplitude attack 1.03 s, decay 3.2 s to −4 dB and release 1.73 s. A −8 dB instrument gain and 50% velocity response follow mild smooth drive. Spacing and motion are explicit Csound choices for the source macros.

Csound control Value
Triangle offsets −12, −6, 0, +6, +12 cents
Drift ±1.2 cents; 0.12 + abs(offset) × 0.005 Hz
A contour 1.03 / 3.2 / −4 dB / 1.73 s
Engine / instrument gain −10 / −8 dB

Sound after step 1 — WebM/Opus

Next: Add the slower octave and stereo filtering →

Step 02 / 5

Add the slower octave and stereo filtering

Set giStage init 2 in the full script. Enable the octave-up sine at −22 dB and +3.125 cents. Give it an independent 1.10 s attack, 4 s decay to −6 dB and 2.20 s release. Filter the triangle channels at 1720 Hz with Q 1.2; reverse the voice weights across the channels, bias A slightly left and B right. The octave enters later than the main cluster and can remain after its release. This interprets Basic Shapes and SVF rather than scanning the original engines.

Csound control Value
A lowpass 1720 Hz, Q 1.2
B pitch / level 2 × note frequency, +3.125 cents / −22 dB
B contour 1.10 / 4.00 / −6 dB / 2.20 s
Stereo voice weights 0.8/0.7/0.5/0.3/0.2, reversed right; sum / 2.5

Sound after step 2 — WebM/Opus

Next: Add filtered stereo echoes →

Step 03 / 5

Add filtered stereo echoes

Set giStage init 3 in the full script. Use 340 ms left and 470 ms right, 30% feedback and 22% wet. Inject the centered input on the left and cross-feed the filtered echoes so later repeats alternate sides. Filter each echo around 1700 Hz, with a 3-octave interval between highpass and lowpass cutoffs. A shared 0.18 Hz sine moves times by ±2% and the filter center by ±0.04 octaves. Feedback values are updated once per 16-sample block, adding that small delay to the recirculating path. Held notes leave older colors behind the current tone.

Csound control Value
Times 340 / 470 ms
Feedback / wet 30% / 22%
Routing Crossed, left input
Filter center / width 1700 Hz / 3 octaves
Time LFO 0.18 Hz, ±2%

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 30 ms predelay into reverbsc, with feedback 0.8119, 3200 Hz damping and 20% wet mix. Predelay leaves the initial articulation in front; feedback prolongs the tail, while damping darkens repeated circulation. The source room decay setting is 3.36 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 3.36 s (not a measured Csound decay)
Predelay / feedback 30 ms / 0.8119
Damping / wet 3200 Hz / 20%
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 6.24 dB gain after the effects. Scale the side signal by 1, preserving the center. Highpass only the side at 160 Hz to focus the lowest frequencies. 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 6.24 dB
Width 1 × side
Bass side cutoff 160 Hz
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 Quartz Ripple 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 1.200192
giSine ftgen 0, 0, 16384, 10, 1
gaLeft init 0
gaRight init 0

instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  kDrift0 oscili 1.2, 0.18, giSine, 0.0
  aV0 vco2 ampdb(-10), iHz*pow(2,(-12.0+kDrift0)/1200), 12, 0.5, 0.0
  kDrift1 oscili 1.2, 0.15, giSine, 0.18
  aV1 vco2 ampdb(-10), iHz*pow(2,(-6.0+kDrift1)/1200), 12, 0.5, 0.18
  kDrift2 oscili 1.2, 0.12, giSine, 0.36
  aV2 vco2 ampdb(-10), iHz*pow(2,(0+kDrift2)/1200), 12, 0.5, 0.36
  kDrift3 oscili 1.2, 0.15, giSine, 0.54
  aV3 vco2 ampdb(-10), iHz*pow(2,(6.0+kDrift3)/1200), 12, 0.5, 0.54
  kDrift4 oscili 1.2, 0.18, giSine, 0.72
  aV4 vco2 ampdb(-10), iHz*pow(2,(12.0+kDrift4)/1200), 12, 0.5, 0.72
  kA linsegr 0, 1.03, 1, 3.2, 0.6309573444801932, 1.73, 0
  aL = (aV0+aV1+aV2+aV3+aV4)/5*kA
  aR = aL
  if giStage >= 2 then
  kB linsegr 0, 1.1, 1, 4, 0.5011872336272722, 2.2, 0
  aB oscili ampdb(-22), iHz*2*pow(2,3.125/1200), giSine, 0
  aB = aB*kB
  aL = (aV0*0.8+aV1*0.7+aV2*0.5+aV3*0.3+aV4*0.2)/2.5*kA
  aR = (aV0*0.2+aV1*0.3+aV2*0.5+aV3*0.7+aV4*0.8)/2.5*kA
  aL lowpass2 aL, 1720.0, 1.2
  aR lowpass2 aR, 1720.0, 1.2
  aL = aL+aB*0.6
  aR = aR*0.85+aB*0.8
  endif
  aL = tanh(aL*1.1)/1.1*ampdb(-8)*(0.5+0.5*iVelocity)
  aR = tanh(aR*1.1)/1.1*ampdb(-8)*(0.5+0.5*iVelocity)
  gaLeft = gaLeft+aL
  gaRight = gaRight+aR
endin
instr 90
  aL = gaLeft
  aR = gaRight
  if giStage >= 3 then
    aDelFbL init 0
    aDelFbR init 0
    kDelMotion oscili 1, 0.18, giSine
    aDelTimeL interp 340.0*(1+0.02*kDelMotion)
    aDelTimeR interp 470.0*(1-0.02*kDelMotion)
    aDelSendL = (aL+aR)*0.5
    aDelSendR = 0
    aEchoL vdelay3 aDelSendL+aDelFbR*0.3, aDelTimeL, 2200
    aEchoR vdelay3 aDelSendR+aDelFbL*0.3, aDelTimeR, 2200
    kDelCenter = 1700.0*pow(2, 0.04*kDelMotion)
    aEchoL butterhp aEchoL, kDelCenter/pow(2, 1.5)
    aEchoL butterlp aEchoL, min(18000,kDelCenter*pow(2, 1.5))
    aEchoR butterhp aEchoR, kDelCenter/pow(2, 1.5)
    aEchoR butterlp aEchoR, min(18000,kDelCenter*pow(2, 1.5))
    aDelFbL = aEchoL
    aDelFbR = aEchoR
    aL = aL*0.78+aEchoL*0.22
    aR = aR*0.78+aEchoR*0.22
  endif
  if giStage >= 4 then
    aRoomInL = aL
    aRoomPreL delay aRoomInL, 0.03
    aRoomInR = aR
    aRoomPreR delay aRoomInR, 0.03
    aRoomL, aRoomR reverbsc aRoomPreL, aRoomPreR, 0.8119, 3200.0, sr, 0.4
    aRoomMid = (aRoomL+aRoomR)*0.5
    aRoomSide = (aRoomL-aRoomR)*0.5*1
    aL = aL*0.8+(aRoomMid+aRoomSide)*0.2
    aR = aR*0.8+(aRoomMid-aRoomSide)*0.2
  endif
  if giStage >= 5 then
    aEndMid = (aL+aR)*0.5
    aEndSide = (aL-aR)*0.5*1.0
    aEndSide butterhp aEndSide, 160.0
    aL = (aEndMid+aEndSide)*ampdb(6.24)
    aL dcblock2 aL, 2048
    aR = (aEndMid-aEndSide)*ampdb(6.24)
    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 4 48 0.8
i 1 7.2 4 55 0.9
i 1 14.4 4 60 0.72
i 90 0 34.6
e
</CsScore>
</CsoundSynthesizer>