*Note: please send all notice of errors to this
email address only; gifts will be awarded: in some form or other, on a scale of relative error
glaringness to all finders on a first come first served basis. The more horrific
the error, the better the prize will be! This is part of a scheme to encourage all users of the group to:
*

- show off your skills (both new and old) and
- to keep all information on the site as accurate as possible.

Please don't get overexcited yet: the prizes apply **only to the Tutorials, Set Tasks and their final write-ups
**, not any old user comment in the forums will count. However if you can help in the forums in any way, perhaps
with a corrected answer, alternative approach, or a constructive criticism please do so; this is how we will all be
continuously learning from one another. We may be a varied group of users, pro's and noob's alike, but here **we are
all equals **: learning, teaching and inspiring each other to further gen~ greatness.

Peace and be gen~erous.

# Task Three - Part A

Build a 2nd, 3rd, 4th... nth order general pole-zero IIR Filter within gen~ and annotate, with comments, to make the process clear.

According to Steven W. Smith, Ph.D. in The Scientist and Engineer's
Guide to Digital Signal Processing we can divide filters into two categories according to their *implementation*
and three categories according to their *application* or *use*. Soon, through future tasks and their accompanying write-ups / tutorials,
we will discover more filters which we can deliberately design and taylor for specific *uses* and needs; we have already discovered one tenuous use in
Tasks One's, moving average filter,
attenuating either high or low frequencies.

Smith states in figure 14.1:

We can divide filters by their *use* into three main categories:

**Time Domain**- (e.g. smoothing, DC removal)
**Frequency Domain**- (e.g. separating frequencies)
**Custom**- (e.g. Deconvolution)

So far we have discovered that there are two approaches to how filters are *implemented*:

**Convolution***Feed-forward*FIR (finite-impulse-response)**Recursion***Feedback*IIR (infinite-impulse-response)

See the table here:

## Back in Time

So, this time we are going to rely on ** feedback** as opposed to feed-forward, as we had done in the previous
Task One and
TaskTwo.

(Alternative archived source of video here)

Having focussed on two types of FIR (finite-impulse-response) filters in
Tasks One
and Two,
discovering that there is limited flexibility (and therefore limited potential use and application for FIR convolution
filters); we have now been led onto creating our first IIR (infinite-impulse-response) or *recursive* filter.

Before diving straight into the monster I had naïvely set for Task 3, let's have a quick look at the difference between FIR and IIR filters. You can download the patch here or by clicking on the picture below.

Diagrams are taken from Curtis Roads' compulsory reading: The Computer Music Tutorial p.185.

### FIR Revision

On the left, **a**, we have an FIR filter (remember these are finite, because we only have feed-forward) we are limited by the amount of
single delay samples we physically chain together (or achieve otherwise), or the computation available. If we double click the gen~ object we can see how
we have delayed one sample with the [history] operator. This has one stage of delay, so is referred to as a *first order* filter.
By summing or subtracting the delayed sample with the current sample we
get a simple FIR low pass or high pass filter. Incorporating the gate operator we can choose between either high pass or low pass
by directing the delayed sample from [history] to either the [+] or [-] operator.

In both of these gen~ objects I have implemented the gate to allow us to toggle between either high pass or low pass by directing the delayed sample from [history] to either the [+] or [-] operator. We have only one single delayed sample here in both examples, so both the FIR and IIR examples are first order filters.

We saw in the previous tutorials that incorporating coefficients we can create more advanced control over the filtering of an FIR filter. Both of these are purely for revision's sake, imitating Roads' diagrams below each filter, so no coefficients here.

The most important thing to remember here is that in **a**, finite impulse response filters are an implementation of *convolution*.
We delay the *input* and add it (or subtract for high pass) and **feed it forward**, as many times as we like;
here we are just doing it the once (per sample).

### IIR Revision

In filter **b**, an infinite impulse response filter, we are implementing *recursion* by delaying the *output* and adding
(or subtracting) it.

Without coefficients, or more importantly, carefully set coefficients, an infinite impulse response filter will work like a delay-line, where outputted samples
re-enter the delay-line *ad infinitum*; that is to say with feedback coefficients at 1, the output will be delayed and re-enter at the same
amplitude, with the result being infinite (as we have here). The filter response, in this case the amplitude, is infinite at the end of the frequency
spectrum we are boosting or attenuating. In other words, when the gate is set to [+] the output of the delay of one sample is fed back at full amplitude
*every single time*, resulting in an infinite boosting of amplitude over time, resulting in distortion, overload and so on. If the gate is set to
[-] the opposite is happening; the attenuation never reaches 0, but at some point the feedback will be below the noise floor, or even lower to become
almost irrelevant in audible terms.

If we introduce coefficients, as we will in Task 3 - Part B, feedback coefficients above 1 will increase in amplitude each time they are fed back;
we will look at these coefficients shortly and compare them to the feed-forward coefficients, but while we are here we should make a mental note that feedback coefficients
*need to be set to below 1* or the filter will become unstable. Think back to the Back To The Future video above... even though Marty McFly is
dealing with gain, it is an increase in amplitude. An IIR filter with feedback above 1 is increasing the amplitude infinitely and is a bad idea, sorry guitarists no settings to 11 please!
We may as well imagine that feedback, where amplitude is increasing each time (i.e. 1 or above), is a position where we will potentially loose control
and blow the thing up, as Marty McFly discovered.

**Infinite Impulse Response filters**. Let's go... (but give me a few more days... sometimes life gets in the way of gen~).

## Infinity Girl

(Alternative archived source of video here)

Task 3 - Part B (Still to come...)

Oh and I'm having internet access issues at the moment so sorry if I haven't been keeping up and won't be able to respond on the group very quickly for a while.