# Estimating pole radius of formant filter from bandwidth

I wish to design an all-pole formant filter by specifying frequency θ (between 0 and π radians for Nyquist) and bandwidth Φ such that the response of the filter at θ-Φ and at θ+Φ should be roughly 50% of the response at θ.

I start by specifying a pole at $p=[r,θ]=re^{jθ}$.

My question is this: How to estimate $r$ as a function of $Φ$?

Note: A fairly crude estimate will suffice for my purposes (vowel synthesis).

This is my approach so far:

Adding a conjugate pole, I construct a transfer function $H(z) = \frac{1}{p-z}\frac{1}{p^*-z}$

$$\frac{1}{H(z)} = (p-z)(p^*-z)$$

$$= pp^* -z(p+p^*) + z^2$$

$$= r^2 -z(2r cos θ) + z^2$$

The gain at frequency α will be $\text{Gain}(α) = |H(e^{jα})|$, so the gain at θ is as follows:

$$\frac{1}{H(e^{jθ})} = r^2 -e^{jθ}(2 rcos θ) + (e^{jθ})^2$$

$$= r^2 -re^{jθ}(e^{jθ} + e^{-jθ}) + e^{j\cdot2θ}$$

$$= r^2 -r(e^{j\cdot2θ} - 1) + e^{j\cdot2θ}$$

$$= r(r-1) - e^{j2θ}(r-1)$$

$$= (r-1)(r - e^{j2θ})$$

So $\text{Gain}(θ) = |H(e^{jθ})| = \frac{1}{(r-1)(r - e^{j2θ})}$ as $0<r<1$. So far so good, nice and tidy!

But now it gets tricky. I require Φ such that:

$$\text{Gain}(θ) = 2 \text{Gain}(Φ)$$

$$\frac{1}{|(r-1)(r - e^{j2θ})|} = \frac{2}{|r^2 -z(2r cos θ) + z^2|} \text{where} z=e^{jΦ}$$

$$2|(r-1)(r - e^{j2θ})| = |r^2 -e^{jΦ}(2r cos θ) + e^{j2Φ}|$$

Now I should be able to split out real and imaginary components inside each modulus: $2|A+jB| = |C+jD| => 4(A^2+B^2) = C^2+D^2$

But this is starting to look very heavy. How would an engineer approach this?

Is there any way I can do it using iPython/numpy/scipy?

• If you don't mind using a general second order biquad filter instead of an all-pole filter, you could use the formulas in the Audio-EQ-Cookbook ('Peaking EQ filter'). You just need to fill in the desired center frequency and bandwidth, and you'll get the filter coefficients. Nov 2, 2015 at 13:53
• @MattL. A peaking filter is not exactly the same as a purely resonant all pole filter. I'm pretty sure the OP wants the latter. Nov 2, 2015 at 23:22
• @Jazzmaniac: That's true, but this was meant as a suggestion/question to the OP. The two filters are similar and for one of them the solution is very simple. Nov 3, 2015 at 7:45

This is an exact solution to the problem. First, a few remarks on what can be achieved and what can't. Unless the pole angle is $\theta=\pi/2$ the response will by asymmetrical, so it's not possible to have the same magnitude response at $\omega_0+\Delta$ and $\omega_0-\Delta$, where $\omega_0$ is the frequency where the amplitude has its peak. Also note that in general $\omega_0\neq\theta$, so the pole angle does not coincide with the location of the maximum. For a large pole radius $r$ and a pole angle $\theta$ not too close to $\omega=0$ and $\omega=\pi$, the pole angle approximates $\omega_0$ reasonably well, but in general it doesn't.

The derivations are a bit tedious, so I will present a cookbook solution, proving its correctness by examples. We're talking about a second order all-pole filter with two complex conjugate poles at $z=re^{j\theta}$ and $z=re^{-j\theta}$:

$$H(z)=\frac{1}{(1-re^{j\theta}z^{-1})(1-re^{-j\theta}z^{-1})}=\frac{1}{1-2r\cos(\theta)z^{-1}+r^2z^{-2}}\tag{1}$$

We want to find $r$ and $\theta$ such that the maximum of $|H(e^{j\omega})|$ occurs at a given value $\omega_0$, and such that its value at $\omega_0\pm\Delta$ is half the maximum value. Since in general not both values at $\omega_0+\Delta$ and $\omega_0-\Delta$ can be identical, we choose to specify the value at $\omega_0+\Delta$ if $\omega_0<\pi/2$, and at $\omega_0-\Delta$ if $\omega_0\ge\pi/2$.

These are the steps for computing the required values of $r$ and $\theta$:

1. Choose the desired peak frequency $\omega_0$ such that $0<\omega_0<\pi$, and the desired width $\Delta$ such that the magnitude assumes half of its peak value at $\omega_0+\Delta$ or at $\omega_0-\Delta$, depending on the value of $\omega_0$ (see below).

2. Define constants \begin{align}B&=2\cos(\omega_0)\cos(\omega_x)-\cos^2(\omega_x)\\ C&=4\cos^2(\omega_0)\\a&=\frac43(B-C)\\b&=\frac23(4B+2C-3)\end{align} where $\omega_x=\omega_0+\Delta$ if $\omega_0<\pi/2$, and $\omega_x=\omega_0-\Delta$ otherwise.

3. Solve the following quartic equation for $R$: $$R^4+aR^3+bR^2+aR+1=0$$ Of the four solutions, choose the one which is real-valued and which satisfies $0<R<1$. This solution is given by $$R=\frac{x}{2}-\sqrt{\frac{x^2}{4}-1}\qquad\text{with}\quad x=-\frac{a}{2}+\sqrt{\frac{a^2}{4}-b+2}\tag{2}$$ The pole radius is then obtained as $r=\sqrt{R}$.

4. Compute the pole angle from $r$ and $\omega_0$: $$\cos(\theta)=\frac{2r}{1+r^2}\cos(\omega_0)$$

The figure below illustrates some designs. $(a)$: $\omega_0=\pi/2$, d=$0.1\pi$, $(b)$: $\omega_0=0.2\pi$, $d=0.05\pi$, $(c)$: $\omega_0=0.8\pi$, $d=0.2\pi$, $(d)$ $\omega_0=0.6\pi$, $d=0.02\pi$. I have here a very pretty answer supplied by @Jazzmaniac, which I will transcribe from our conversation (on IRC Freenode ##dsp). The key insight is that the gain is inversely proportional to the distance from the pole.

So, double the distance, halve the gain.

(This can be seen by imagining a single pole on the origin with the transfer function $$H(z) = 1/z$$)

The small circle represents the peak gain (at frequency $$e^{jθ}$$).

The bigger circle represents a locus of half that gain.

Hence, it is clear that $$Φ$$ = bandwidth/2

It is worth observing that we now have $$r(Φ)$$ (i.e. r is independent of $$θ$$).

• dsprelated.com/freebooks/filters/… gives a simpler formula!
– P i
Nov 3, 2015 at 10:47
• That simpler formula only holds in the limit of infinite sampling rate! Nov 3, 2015 at 10:57
• @Jazzmaniac I am forever grateful for your expertise, patience and tutelage from the IRC days. Are you reachable these days? I sent an email to your soundtheory address some weeks back.
– P i
Jun 1 at 15:40