Comb filter

When creating a reverb tail, one thing we’re after is to prolong the sound, so it might make sense to add delayed copies of the dry sound. One way of doing this is by using a comb filter. The adding of delayed copies creates constructive (crest meet crest) and destructive (crest meets trough) interference. This results in regularly spaced spikes and notches in the spectrum, and hence the name “comb” filter. We have comb filters with feedback (infinite impulse response), and also implementations without feedback (finite impulse response)

A FIR comb filter
An IIR comb filter

You could look at a comb filter as a crude simulation of standing waves in a room, created by sound travelling back and forth between parallel walls.

Reflections between parallel walls

The sound of the comb filter colors the sound noticeably, as can be heard in the following sound examples:


Input sound 1: Short burst of white noise

Input sound 2: A short guitar phrase

Noise burst with comb filter, M=500, a=0.8, b=-a

Guitar with comb filter, M=500, a=0.8, b=-a

Noise burst with comb filter, M=900, a=0.8, b=-a

Guitar with comb filter, M=900, a=0.8, b=-a

Csound code

The following Csound code makes a comb filter, processing external audio input

;***************************************************
; comb filter
;***************************************************
	instr 2

; initialization
	a1		in			; read audio
	iM1		= p4			; delay time in number of samples
	iM1		= iM1*(1/sr)		; convert delay time from samples to seconds
	iA		= -0.8			; coefficient A (feedback, normally negative)
	iB		= 0.8			; coefficient B (gain of filter)
	afeed1		init	0		; initialize the feedback signal

; IIR comb filter
	ain		= a1 + afeed1		; sum input and feedback
	adel1		delay	ain, iM1	; delay by M samples
	afeed1		= adel1 * iA		; feedback scaled by coefficient A
	aout		= ain*iB		; output scaled by coefficient B

; audio out
			out	aout
	endin

;***************************************************