# What is the purpose of the recurrence relation in low and high pass (audio) filters?

Newbie here. I'm familiar with time and frequency domains from math. I think I understand what low and high pass filters do, sonically. But digging into an implementation of tone in csounds, I think I'm missing something fundamental. Take this description:

A first-order recursive low-pass filter with variable frequency response.

tone is a 1 term IIR filter. Its formula is:

yn = c1 * xn + c2 * yn-1

where

• b = 2 - cos(2 π hp/sr);

• c2 = b - sqrt(b2 - 1.0)

• c1 = 1 - c2

I see that there is a recurrence relation. But I'm reading about IIRs and filters in general I don't see any explanation of why it's there or what it does.

• Would performing a single pass of this formula not be considered performing a "true" low or high pass filter?

• Or is that it takes multiple passes (infinite, in theory) to completely "remove" the frequencies desiring to be removed, so it's a tradeoff between iterations versus computation?

I'm gravitating toward the latter, but I don't see where that is being said. Can someone point me to the essential statement of it on Wikipedia or somewhere?

An IIR filter is a recursive one. It means, current value of output $$y[n]$$ is computed based on its previous value(s).

Consider a simple 1st order IIR filter definition:

$$y[n] = a \cdot y[n-1]+ b \cdot x[n]$$

$$a$$ and $$b$$ are the filter coefficients.

Now assume you have a long block of N samples input data. If you want to process that block of input data with this filter, you can do it like in this matlab code :

N = 1024;       % number of input samples
x = randn(N,1); % some random input.
a = 0.5;        % IIR filter coefficients
b = 0.9;

yi = 0;         % initial value for output
y = zeros(N,1); % matrix (array) to hold processed output samples

y(1) = a*yi + b*x(1)   % assign first output sample based on y(-1)
for n=2:N              % assign rest
y(n) = a*y(n-1) + b*x(n);
end

• Yes, but why? I guess to anyone in the field it might sound like I'm asking, "Why does addition work?" Maybe I'm asking: How is the sound changing in each iteration? Is it improving the filtering? How is it determined how many iterations to compute, since obviously we can't compute infinity? – Andrew Cheong Oct 3 at 20:03
• Oh, maybe your code does clarify things. Is it doing a pass over the input samples in time, e.g. y(t)? So a previous calculation in time is affecting the next? – Andrew Cheong Oct 3 at 20:06
• Ah, "successive approximation" is exactly what I thought it was doing. And I thought that because it felt unbelievable to me that an algorithm can remove frequencies in a single pass over the time domain... but apparently it can. That's crazy. – Andrew Cheong Oct 3 at 20:29
• @AndrewCheong yes that's a good question and so is this answer link – Fat32 Oct 3 at 20:47
• Holy crap, I can't wait to read all these. Thanks very much. I would even say that it's valid to close this question as a duplicate of that last one. I just didn't know how to ask what I was confused about. – Andrew Cheong Oct 3 at 21:00