# Low pass filter (revisited)

Recently I’ve examined in depth the theory behind digital filters and I think I’ve eventually understood what is going on at page 183 of Andy Farnell’s Design Sound book. Indeed, at the end of chapter 10, Andy talks about a way to filter out quick fluctuations on a floating point number stream.

This patch, he says, is a simple low pass filter that follows this filter equation:

The strenght of the filter is set by the ratio $A : B$. Both $A$ and $B$ should be between $0.0$ and $1.0$ and add up to $1.0$.

This patch was earlier mentioned here while now I would like to continue examing it in more depth.

As I said earlier now that I’ve acquired greater certainty on the subject I want to fix here some of the things I consider to be important to remember.

First of all, this patch is an implementation of a recursive filter, i.e. a filter which feed back its previuos output to compute the next one.

Let’s examine the general case first (see Miller section 7.4 Recirculating Delay network

Here we add the incoming signal to a delayed copy of itself but, prior to do that, we multiply the latter by a gain factor. Here d is the delay time and g is the feedback coefficient.

In order to keep this network stable, g must be lesser than 1!

The frequency response of such a delay netwrok configuration is shown in the image below:

Then note that at DC and $\frac{2 \pi}{d}$ multiples the gain is $\frac{1}{1-g}$.

Now lets reduce the delay time to a single sample (Miller section 8.2.3 Elementary recirculating filter and Pirkle section 5.15 First-Order Feed-Back Filter Revisited), and draw a new diagram of the same recirculating filter:

(Don’t mind if some symbols look different from the diagram we’ve seen before, essentially the working principle is the same: the incoming signal is added with a deleyad copy of itself. The delay last only 1 single sample and the delay copy is scaled down usign g, the feedback coefficient.)

The frequency response is similar to the one from before, the only difference is in where these peaks are:

Now the peaks are located at $2\pi$ multiples which means we have a peak at DC and one at Nyquist ($\frac{f_s}{2}$). If we concentrate our attention only on the audible spectrum (approximately from 0 to $\pi$ radians) we can see this delay network behaves like a low pass filter!

Now, what about if we want unity gain at these peaks? We can multiply the input signal for a normalization factor of $1-g$:

An interesting thing to note here is the place we inserted the normalization factor: we placed on the input side instead of the output. Even if in theory it would have been the same thing, we need to consider some side effects as described by Miller in section 8.3.9 Time varying coefficients.

Now let’s pause for a moment and look back where we started. Now its clearer where the theory behind Farnell patch comes from: the $B$ coefficient is indeed the feedback coefficient of a recirculating delay network (g) while $A$, used to multiply the input, is the normalization factor (we saw its value is equal to $1-g$).

Now the formula below becomes pretty starightforward

it is indeed the same as

Now is also clear why $B$ (and $A$) must be lesser than one and $A$ and $B$ must sum up to 1: this is the “recipe” to build up a low pass filter!

But how to set g in order to get a filter with the exact cutoff frequency we want?

## Cut frequency eveluation

On how to solve this problem, I suggest to take a look to the theory (Miller section 8.3.1 One-pole low-pass-filter) while here we can make the long story short.

We can say that, for geometrical considerations on the complex plane (see image below),

…if we consider an half power pulsation which is relatively small, we can also write:

which implies that, beeing $R$ the sampling frequency, we can obtain the cut frequency ($f_c$) from the relation below:

which can be further transformed into

Using this formula we can get both the normalization factor and the feedback coefficient, having the cutoff frequency and the sampling rate!

## References

Here are some of the resources which helped me the most to understand the subject:

### Books

If you find this article useful and you like it, please leave a comment below: let us know what do you think about it, we'd really appreciate it. Thank you very much and, as always, stay tuned for more to come!