The basic comb filter is given by
which has L equally-spaced zeros or poles at the radius r. In the diagram below, r is very close to the unit circle.>> L = 16; >> r = 0.995 >> [b,a] = comb(r,L); >> [z,p,k] = tf2zp(1,b); % IIR comb >> zplane(z,p)
>> [h,w] = freqz(1,b); >> plot(w/pi,abs(h)); >> xlabel 'Normalized frequency (Nyquist==1)' >> ylabel 'Magnitude Response' >> wavwrite(y,'comb.wav');
>> [h,w] = freqz(b,1); >> plot(w/pi,abs(h)); >> ylabel 'Magnitude Response' >> xlabel 'Normalized frequency (Nyquist==1)'
function [b,a] = COMB(r,L) % COMB % % [b,a] = COMB(r,L) % % generates L zeros equally spaced around a circle of radius r b = [1 zeros(1,L-1) -r^L]; a = [1 zeros(1,L-1)];
An IIR comb filter is the start of a simulation of plucked string, like a guitar string.
>> r =0.9995 >> L = 75 >> fs = 22050 >> [b,a] = comb(r,L) >> y = filter(1,b,im); >> wavwrite(y,fs,'comb2.wav');
The impulse response of a IIR comb is a periodic sequence of impulses at the fundamental frequency fs/L that decays at a rate determined by r. If you listen to the comb impulse, that's what you hear, a buzzy sound with pitch fs/L that dies away.
What we are missing is that the different frequency components produced by a vibrating string die away at different rates. The high frequencies die away much faster than the low frequencies. We can simulate this effect by inserting a lowpass filter in the feedback loop:
>> b = [1 1]/2; >> a = [1 zeros(1,L-1) -r^L*b ]; >> ys = filter(b,a,im); >> ys = ys/max(abs(ys)); >> wavwrite(ys,fs,'comb3.wav');
Maintained by John Loomis, last updated 6 Nov 1997