playgrid.ccRead tutorial

Tutorial 022 / Csound

Build Apricot Pulse in Csound

Build Apricot Pulse in Csound with a narrow pulse, octave sine, a fast filter contour, light chorus and a compact stereo room.

5 stepsPulse KeysCsound 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 pulse-key amplitude contour

Set giStage init 1. Use vco2 mode 2 with a fixed pulse width of 0.32 and oscillator gain −7 dB. The unequal duty cycle supplies a hollow but bright harmonic shape.

aAttack linseg 0, 0.005, 1, 1, 1
aDecay expsegr 1, 0.005, 1, 1.40, 0.15, 0.420, 0.000001

Multiply the gate and exponential envelope. The gate rises over 5 ms; after that opening interval, the decay falls toward 0.15 over 1.40 s. Note-off starts a 420 ms exponential release to a quiet positive floor. Apply −6 dB amplifier gain and −7 dB instrument gain, then multiply by velocity squared. This explicit touch curve interprets Analog's velocity response rather than copying its internal scaling. The pulse remains centered, with no unison or glide.

Sound after step 1 — WebM/Opus

Next: Add an octave sine and a closing resonant lowpass →

Step 02 / 5

Add an octave sine and a closing resonant lowpass

Set giStage init 2. Add a sine one octave above the pulse at −22 dB, then send both sources into the same 24 dB/octave ladder lowpass.

kCutoff = limit(950*pow(2, 2.30*kFilter+0.70*(p4-60)/12), 30, 18000)
aDrive = tanh(aSource*1.3)/1.3
aSource moogladder aDrive, kCutoff, 0.16

Build kFilter from a 5 ms attack gate and an exponential decay to 0.08 over 320 ms, with a 250 ms release. Interpreting depth 2.30 as octaves gives a bright initial opening that closes much faster than the amplitude. Key tracking is 0.70 octaves per keyboard octave around MIDI 60. The soft input curve and resonance 0.16 interpret Analog's Sym1 and resonance controls. The ladder is a different filter design, so its response is not identical to Analog's.

Sound after step 2 — WebM/Opus

Next: Give the keys a light stereo chorus →

Step 03 / 5

Give the keys a light stereo chorus

Set giStage init 3. Highpass only the chorus input at 180 Hz; keep the direct pulse body full-band. Modulate two delay taps around 12 ms by ±2.4 ms, with opposite motion at 0.32 Hz.

aTimeL interp 12+2.4*kMotion
aTimeR interp 12-2.4*kMotion
aChorusL vdelay3 aHigh, aTimeL, 40
aChorusR vdelay3 aHigh, aTimeR, 40

Mix 82% direct and 18% chorus in each channel. The moving taps give sustained portions a slight stereo pitch shimmer, while the input highpass reduces low-end blur. The 2.4 ms excursion is a Csound choice for the source Amount 12%; it is not a literal percentage-to-time conversion.

Sound after step 3 — WebM/Opus

Next: Place the keys in a compact room →

Step 04 / 5

Place the keys in a compact room

Set giStage init 4. Feed the chorus mix through 12 ms of predelay into reverbsc with feedback 0.74 and damping at 4500 Hz. Blend 83% chorus mix with 17% room.

Predelay leaves the pulse attack in front; damping softens the high-frequency reflections as the tail fades. Feedback 0.74 interprets the role of the source's 1.80 s room, without assigning it that exact decay time. Diffusion, shelves and room-size parameters are represented by this different reverb algorithm rather than copied numerically.

Sound after step 4 — WebM/Opus

Next: Set the final gain and remove DC →

Step 05 / 5

Set the final gain and remove DC

Set giStage init 5. Apply +4.80 dB and dcblock2 to each output channel. Keep the chorus and room's stereo image unchanged; no bass narrowing is added.

The gain follows both effects, so it raises the short pulse body and the diffuse tail together. Clear gaVoice after each control block, leaving the effects' own memory intact. The finished keys have a sharp harmonic opening, a softer sustained body and a light stereo halo.

Sound after step 5 — WebM/Opus

Audio & settings ↓

Audio & settings

Audio recordings and settings for this tutorial.

Full Csound script

The complete Apricot Pulse instrument and shared effects. giStage selects cumulative stages 1–5; 5 is the finished sound. Instrument 1 takes held seconds, MIDI pitch and velocity in p3–p5. Instrument 90 carries the output and any effect tails.

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

giStage init 5
giSine ftgen 0, 0, 16384, 10, 1
gaVoice init 0
instr 1
  iHz = cpsmidinn(p4)
  iVelocity = limit(p5, 0, 1)
  aPulse vco2 ampdb(-7), iHz, 2, 0.32
  aSource = aPulse
  if giStage >= 2 then
    aOctave oscili ampdb(-22), iHz*2, giSine
    aSource = aSource+aOctave
    kAttack linseg 0, 0.005, 1, 1, 1
    kDecay expsegr 1, 0.005, 1, 0.320, 0.08, 0.250, 0.000001
    kFilter = kAttack*kDecay
    kCutoff = limit(950*pow(2, 2.30*kFilter+0.70*(p4-60)/12), 30, 18000)
    ; Smooth input shaping interprets the filter's Sym1 drive.
    aDrive = tanh(aSource*1.3)/1.3
    aSource moogladder aDrive, kCutoff, 0.16
  endif
  aAttack linseg 0, 0.005, 1, 1, 1
  aDecay expsegr 1, 0.005, 1, 1.40, 0.15, 0.420, 0.000001
  aAmp = aAttack*aDecay*ampdb(-6)*ampdb(-7)*iVelocity^2
  gaVoice = gaVoice+aSource*aAmp
endin
instr 90
  aLeft = gaVoice
  aRight = gaVoice
  if giStage >= 3 then
    aHigh butterhp gaVoice, 180
    kMotion oscili 1, 0.32, giSine
    aTimeL interp 12+2.4*kMotion
    aTimeR interp 12-2.4*kMotion
    aChorusL vdelay3 aHigh, aTimeL, 40
    aChorusR vdelay3 aHigh, aTimeR, 40
    aLeft = gaVoice*0.82+aChorusL*0.18
    aRight = gaVoice*0.82+aChorusR*0.18
  endif
  aMixL = aLeft
  aMixR = aRight
  if giStage >= 4 then
    aPreL delay aLeft, 0.012
    aPreR delay aRight, 0.012
    aRoomL, aRoomR reverbsc aPreL, aPreR, 0.74, 4500
    aMixL = aLeft*0.83+aRoomL*0.17
    aMixR = aRight*0.83+aRoomR*0.17
  endif
  if giStage >= 5 then
    aMixL dcblock2 aMixL*ampdb(4.80), 2048
    aMixR dcblock2 aMixR*ampdb(4.80), 2048
  endif
  outs aMixL, aMixR
  clear gaVoice
endin
</CsInstruments>
<CsScore>
i 1 0.0 1.2 60 0.80
i 1 0.0 1.2 64 0.80
i 1 0.0 1.2 67 0.80
i 1 3.6 1.2 57 0.90
i 1 3.6 1.2 62 0.90
i 1 3.6 1.2 65 0.90
i 90 0 12
e
</CsScore>
</CsoundSynthesizer>