The Flanger effect is normally made with a single variable delay lines, mixed with the dry (unmodulated) signal. The delay time is set so low that it creates comb filtering effects (like sound being reflected between parallel walls in a rom). The comb filtering is the result of constructive and destructive interference between the delayed and the dry signal. At some frequencies the two singlas will cancel each outher out and we get attenuation, at other frequencies the two signals will add constructively and we get resonant peaks. In a Flanger effect, we can also use feedback in the delay line, and this will create a more prominent peaks and notches in the spectrum, since the comb filtering effect will be applied repeatedly on the same signal when it is fed back.
We will use an LFO (Low Frequency Oscillator) to modulate the delay time. The normal delay time range for a Flanger is between 1 – 15 milliseconds. If the delay time is longer than ~15 ms, we start approaching the delay time range of the Chorus effect, and we will lose the typical comb filtering associated with the Flanger. It is however quite possible to move gradually from a Flanger configuration to a Chorus configuration, creating a morphing between the two effects.
The following Csound code makes a Flanger effect
;***************************************************
; audio generator and flanger
;***************************************************
instr 1
; audio generator
iamp = ampdbfs(p4)
a1 loscil iamp, 1, giSample, 1
; flanger
kMix = 0.5 ; flanger wet/dry mix
aDepth = 5 ; flanger depth (in milliseconds)
kRate = 0.2 ; flanger rate (speed)
kFeed = 0.75 ; flanger feedback
; output level adjustment, as level change with modulation and feedback
iLevelAdjust = 0.5
iOffset = .1 ; delay time offset
iFlangWave = giSine ; flanger waveform
aDelayTime oscili 0.5, kRate, iFlangWave ; delay time oscillator (LFO)
aDelayTime = ((aDelayTime+0.5)*aDepth)+iOffset ; scale and offset LFO
iMaxDelay = 0.1 ; max delay time
iWindowSize = 4 ; interpolation size
aFeed init 0 ; initialize the feedback signal
aFlanger vdelayx a1+aFeed, aDelayTime*0.001, iMaxDelay, iWindowSize ; time varying delay
aFeed = aFlanger*kFeed ; mix output to feedback
aOut = ((a1*sqrt(1-kMix)) + (aFlanger*sqrt(kMix))) * iLevelAdjust
; audio out
outs aOut, aOut
endin
;***************************************************