The Chorus effect is made with one or more variable delay lines, mixed with the dry (unmodulated) signal. The modulating delay time creates a subtle pitch shift, and when the pitch shifted signal is mixed with the dry siignal, it creates an impression of several voices playing or singing the same thing. Like the voices of a chorus, hence the name of the effect.
We will use an LFO (Low Frequency Oscillator) to modulate the delay time. The normal delay time range for a Chorus is between 20 – 50 milliseconds. If the delay time is shorter than ~20 ms, we may get comb filtering and this approaches the sound of the Flanger. If the delay time is longer than ~50 ms, we begin to hear the delay as a distinct echo. To achieve a a smooth Chorus effect, we stay within these approximate boundaries. The amount of perceived pitch shift depends on the range of the delay time modulation, but also on the speed of modulation. With a higher modulation speed, we perceive more pitch shift.
The following Csound code makes a stereo Chorus with one time varying delay line for the left channel and another for the right channel.
;***************************************************
; audio generator and stereo chorus
;***************************************************
instr 1
; audio generator
iamp = ampdbfs(p4)
a1 loscil iamp, 1, giSample, 1
; chorus, dual voice
kMix = 0.8 ; chorus wet/dry mix
aDepth = 14 ; chorus depth (in milliseconds)
kRate = 0.2 ; chorus rate (speed)
iOffset = 20 ; delay time offset
iChorWave = giSine ; chorus waveform
aDelayTime1 oscili 0.5, kRate, iChorWave, 0 ; delay time oscillator (LFO)
aDelayTime2 oscili 0.5, kRate, iChorWave, 0.25 ; delay time oscillator (LFO)
aDelayTime1 = ((aDelayTime1+0.5)*aDepth)+iOffset ; scale and offset LFO
aDelayTime2 = ((aDelayTime2+0.5)*aDepth)+iOffset ; scale and offset LFO
iMaxDelay = 1 ; max delay time
iWindowSize = 4 ; interpolation size
; time varying delay
aChorus1 vdelayx a1, aDelayTime1*0.001, iMaxDelay, iWindowSize
aChorus2 vdelayx a1, aDelayTime2*0.001, iMaxDelay, iWindowSize
aOutL = ((a1*sqrt(1-kMix)) + (aChorus1*sqrt(kMix)))
aOutR = ((a1*sqrt(1-kMix)) + (aChorus2*sqrt(kMix)))
; audio out
outs aOutL, aOutR
endin
;***************************************************