playgrid.ccRead tutorial

Tutorial 119 / Csound

Build Ribbon Ensemble in Csound

Build Ribbon Ensemble in Csound with layered oscillators synthesis, explicit contours and the sound-shaping chain explained in the guide.

5 stepsLayered OscillatorsCsound 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 detuned source and amplitude contour

Set giStage init 1 in the full script. Use 5 band-limited saw voices at -13 dB each, spread by 9 cents between adjacent voices. Reverse the stereo weights across the channels. The amplitude opens in 0.45 seconds, decays over 2.4 seconds to 0.891251, and releases over 1.8 seconds. Basic Shapes is represented by this explicit waveform; Shimmer, where present, becomes slow independent pitch drift rather than the original unison engine.

Csound control Value
Sources 5 × saw, -13 dB
Adjacent pitch spacing 9 cents
Amp A/D/S/R 0.45 s / 2.4 s / 0.891251 / 1.8 s
Instrument gain -8 dB
Velocity multiplier 0.4 + 0.6 × velocity

Sound after step 1 — WebM/Opus

Next: Blend the second source and animate the filters →

Step 02 / 5

Blend the second source and animate the filters

Set giStage init 2 in the full script. Add a pulse layer at -16 dB, 0 semitones and 7 cents. The lowpass center starts from 4200 Hz and moves by 0.5 octaves under the second envelope. A positive depth opens the spectral ceiling; a negative depth moves the notch downward. The serial second filter keeps the specified high or low edge under control. Exact wavetable morphing, Warp/Fold and free-running source modulation are not implemented; the code below defines the chosen static spectra and note-local drift.

Csound control Value
Secondary layer pulse, -16 dB; 0 st; 7 cents
Filter 1 Lowpass, 4200 Hz base, 0.5 octave depth
Filter contour 1.5 / 2.8 / 0.85 / 2
Filter 2 Highpass at 110 Hz
Pulse width 0.48

Sound after step 2 — WebM/Opus

Next: Add moving stereo chorus →

Step 03 / 5

Add moving stereo chorus

Set giStage init 3 in the full script. Move two delay taps around 20 ms by ±5 ms at 0.38 Hz, with opposite phases and 30% wet mix. Highpass only the wet inputs at 220 Hz to leave the direct low body clear. Scale side information by 1.1; tap feedback is 0. These explicit tap depths interpret the source Amount and ensemble movement rather than copy the internal algorithm. Sustained notes reveal slow pitch interference.

Csound control Value
Tap center / excursion 20 / ±5 ms
Rate / wet 0.38 Hz / 30%
Wet highpass 220 Hz
Width / feedback 1.1 / 0
Warmth shaping 15% smooth-drive interpretation

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 22 ms predelay into reverbsc, with feedback 0.764, 3500 Hz damping and 24% wet mix. Predelay leaves the initial articulation in front; feedback prolongs the tail, while damping darkens repeated circulation. The source room decay setting is 2.6 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 2.6 s (not a measured Csound decay)
Predelay / feedback 22 ms / 0.764
Damping / wet 3500 Hz / 24%
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 4.39 dB gain after the effects. Scale the side signal by 1, preserving the center. Highpass only the side at 180 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 4.39 dB
Width 1 × side
Bass side cutoff 180 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 Ribbon Ensemble 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.9073999
giSine ftgen 0, 0, 16384, 10, 1
gaLeft init 0
gaRight init 0

instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  kJ0 oscili 0, 0.1, giSine, 0.0
  aV0 vco2 ampdb(-13.0), iHz*pow(2,(-18.0+kJ0)/1200), 0, 0.5, 0.0
  if giStage >= 2 then
  aW0 vco2 ampdb(-16.0), iHz*pow(2,0/12+(-11.0)/1200), 2, 0.48, 0.0
  aV0 = aV0+aW0
  endif
  kJ1 oscili 0, 0.13, giSine, 0.2
  aV1 vco2 ampdb(-13.0), iHz*pow(2,(-9.0+kJ1)/1200), 0, 0.5, 0.2
  if giStage >= 2 then
  aW1 vco2 ampdb(-16.0), iHz*pow(2,0/12+(-2.0)/1200), 2, 0.48, 0.2
  aV1 = aV1+aW1
  endif
  kJ2 oscili 0, 0.16, giSine, 0.4
  aV2 vco2 ampdb(-13.0), iHz*pow(2,(0.0+kJ2)/1200), 0, 0.5, 0.4
  if giStage >= 2 then
  aW2 vco2 ampdb(-16.0), iHz*pow(2,0/12+(7.0)/1200), 2, 0.48, 0.4
  aV2 = aV2+aW2
  endif
  kJ3 oscili 0, 0.19, giSine, 0.6
  aV3 vco2 ampdb(-13.0), iHz*pow(2,(9.0+kJ3)/1200), 0, 0.5, 0.6
  if giStage >= 2 then
  aW3 vco2 ampdb(-16.0), iHz*pow(2,0/12+(16.0)/1200), 2, 0.48, 0.6
  aV3 = aV3+aW3
  endif
  kJ4 oscili 0, 0.22, giSine, 0.8
  aV4 vco2 ampdb(-13.0), iHz*pow(2,(18.0+kJ4)/1200), 0, 0.5, 0.8
  if giStage >= 2 then
  aW4 vco2 ampdb(-16.0), iHz*pow(2,0/12+(25.0)/1200), 2, 0.48, 0.8
  aV4 = aV4+aW4
  endif
  aL = (aV0*0.8+aV1*0.65+aV2*0.5+aV3*0.3500000000000001+aV4*0.20000000000000007)/2.5
  aR = (aV0*0.2+aV1*0.35+aV2*0.5+aV3*0.6499999999999999+aV4*0.8)/2.5
  if giStage >= 2 then
  kFilter linsegr 0, 1.5, 1, 2.8, 0.85, 2.0, 0
  kCut = limit(4200.0*pow(2,0.5*kFilter+0.15*(p4-60)/12),30,18000)
  aL lowpass2 aL, kCut, 1.08
  aL butterhp aL, 110.0
  aR lowpass2 aR, kCut, 1.08
  aR butterhp aR, 110.0
  endif
  kAmp linsegr 0, 0.45, 1, 2.4, 0.8912509381337456, 1.8, 0
  kGain = kAmp*ampdb(-8.0)*(0.4+0.6*iVelocity)
  aL = aL*kGain
  aR = aR*kGain
  gaLeft = gaLeft+aL
  gaRight = gaRight+aR
endin
instr 90
  aL = gaLeft
  aR = gaRight
  if giStage >= 3 then
    aChFbL init 0
    aChFbR init 0
    aChInL butterhp aL, 220.0
    aChInR butterhp aR, 220.0
    kCh oscili 1, 0.38, giSine
    aChTimeL interp 20+5.0*kCh
    aChTimeR interp 20-5.0*kCh
    aTapL vdelay3 aChInL+aChFbL*0, aChTimeL, 80
    aTapR vdelay3 aChInR+aChFbR*0, aChTimeR, 80
    aChFbL = aTapL
    aChFbR = aTapR
    aL = aL*0.7+aTapL*0.3
    aR = aR*0.7+aTapR*0.3
    aChMid = (aL+aR)*0.5
    aChSide = (aL-aR)*0.5*1.1
    aL = aChMid+aChSide
    aR = aChMid-aChSide
    aL = tanh(aL*1.15)/1.15
    aR = tanh(aR*1.15)/1.15
  endif
  if giStage >= 4 then
    aRoomInL = aL
    aRoomPreL delay aRoomInL, 0.022
    aRoomInR = aR
    aRoomPreR delay aRoomInR, 0.022
    aRoomL, aRoomR reverbsc aRoomPreL, aRoomPreR, 0.764, 3500.0, sr, 0.4
    aRoomMid = (aRoomL+aRoomR)*0.5
    aRoomSide = (aRoomL-aRoomR)*0.5*1
    aL = aL*0.76+(aRoomMid+aRoomSide)*0.24
    aR = aR*0.76+(aRoomMid-aRoomSide)*0.24
  endif
  if giStage >= 5 then
    aEndMid = (aL+aR)*0.5
    aEndSide = (aL-aR)*0.5*1.0
    aEndSide butterhp aEndSide, 180.0
    aL = (aEndMid+aEndSide)*ampdb(4.39)
    aL dcblock2 aL, 2048
    aR = (aEndMid-aEndSide)*ampdb(4.39)
    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 3 48 0.8
i 1 6 3 55 0.9
i 1 12 3 60 0.72
i 90 0 32
e
</CsScore>
</CsoundSynthesizer>