# Calculating and controlling the location and bandwidth of individual notches in an allpass phaser

I'm currently working on a phaser implementation with the intention of adding some parameters that generate unique effects, namely effects that involve the precise placement of the phaser notches (e.g., "squashing" the phaser notches so the more central notches' center frequencies are biased up or down, while the outer notches retain their position). At current, the implementation is a group of 2-pole IIR allpass filters processed in sequence. In their base state, they all share the same cutoff frequency and Q factor (which are converted to IIR allpass coefficients). I've been able to vaguely simulate the effects I'm looking for by twiddling the cutoff/Q of individual allpasses with some success, but it's becoming more and more frustrating how unpredictable the results can be.

What I'd like to know is if/how one can take a set of desired notch frequencies and bandwidths for a phaser, and turn that into a set of coefficients for the phaser's allpass filters. I had almost no exposure to the theory of IIR filters in general before I started work on this, but from what I've collected over the past couple weeks this would be, at minimum, very difficult. The closest I've come to some kind of method for this is mentioned in this CCRMA article:

"The phaser will have a notch wherever the phase of the allpass chain is at $$\pi$$ (180 degrees)."

To my understanding, however, this would involve plugging the generalized transfer function of each phaser into the next, in sequence, finding the poles of this amalgamated transfer function, and then breaking the equation down in reverse to find the coefficients of the individual filters. This seems impractical to do on paper and almost impossible to do programmatically, but I'm not familiar enough with the math to know if I'm missing something. I'd greatly appreciate any guidance on how this problem could be solved, or if it's just wholly impractical and should be abandoned.

Thank you!

## 2 Answers

There are different ways to approach this. Let's start with a few properties.

1. A second order allpass has one complex conjugate pole pair (and the zeros that are the inverse of the poles.
2. The phase starts at $$0$$, is $$-\pi$$ at the center frequency and $$-2\pi$$ at Nyquist
3. The higher the Q, the sharper the phase transition around the center frequency is
4. The phase of the cascaded sections is the sum of the phases of all the individual sections.

For any set of center frequency $$f_n$$ and Qs $$Q_n$$ we can easily calculate the transfer function and the phase. The notches will occur where the phase is an odd multiple of $$\pi$$. For $$N$$ allpass sections we get exactly $$N$$ notches.

To derive $$f_n$$ and $$Q_n$$ from the desired notch frequencies and bandwidth, we would have to invert this non-linear equation and that's indeed a bit of a chore.

A bunch of workarounds:

1. If you turn up the Q, the notch frequencies will actually be the same as the center frequencies of the sections. This will allow you to place the notches precisely, although the bandwidth will be small.
2. Use a "parametric" model. If, for example, you use the same $$f$$ and $$Q$$ for all sections, changing $$f$$ will move the notches up and down and changing $$Q$$ will increase/decrease the notch spacing.
3. Table it up. Calculate the notch frequencies and bandwidths for a sufficient combinations of $$f_n$$ and $$Q_n$$ and than create an inverse lookup table or polynomial interpolation.

Some hybrids are also possible. For example you can start with method 1 and then table up correction factors based on distance and Q of neighboring sections.

• This is all great information! One key insight that completely went over my head until now is that the phase of the final output is the summed, wrapped phase at that frequency for all the allpass filters. This has been immensely helpful, thank you so much! Jun 10, 2022 at 16:57

Although the name phaser comes from the chain of phase only (all-pass) filters, you don't have to implement it that way. Instead, have a cascade of second order notch sections. You can put the individual notch frequencies anywhere you want, with the Q's adjusted to taste. No problems just moving the frequencies of the inner notches only.

It is more coefficient calculation, though. If you want some peaks between the notches - like a standard phaser has with feedback - you just add more second order sections with peak responses.

• Thank you! I was also thinking about the possibility of an array of notch filters, but I wanted to see an all pass implementation was possible, specifically so I didn’t have to worry about emulating stuff like feedback behavior by tuning notch filters. However, you’ve given me some great insight if I do end up turning to that! Jun 10, 2022 at 16:28