Given the first-order IIR allpass filter depicted below, I would like to calculate the coefficient $a_1$ such that a phase shift of $\frac{\pi}{2}$ occurs at a desired frequency $f_\mathrm{c}$ (the center frequency or break frequency).

First-order allpass filter

Some sources (e.g. Zölzer's DAFX) suggest $a_1 = \frac{\tan\left(\pi\frac{f_\mathrm{c}}{f_\mathrm{s}}\right)-1}{\tan\left(\pi\frac{f_\mathrm{c}}{f_\mathrm{s}}\right)+1}$, whereas this phaser implementation uses $a_1 = \frac{1-\frac{2f_\mathrm{c}}{f_\mathrm{s}}}{1+\frac{2f_\mathrm{c}}{f_\mathrm{s}}}$ (which may be a rough approximation to $-\frac{\tan\left(\pi\frac{f_\mathrm{c}}{f_\mathrm{s}}\right)-1}{\tan\left(\pi\frac{f_\mathrm{c}}{f_\mathrm{s}}\right)+1}$, but I am not sure). However, I cannot find a justification for any of the two equations, so I am trying to derive it myself.

The allpass filter has a transfer function of $$ H(z) = \frac{a_1 + z^{-1}}{1+a_1z^{-1}}. $$ Its phase response is $$ \arg\left(H(e^{j\omega})\right)=\tan^{-1}\left(\frac{({a_1}^2-1)\sin(\omega)}{({a_1}^2+1)\cos(\omega)+2a_1}\right). $$

Since I am interested in $a_1$ as a function of $\omega$, I attempted to substitute the left-hand side with $\frac{\pi}{2}$ (the desired phase shift at $\omega$) and solve for $a_1$, but that does not get me anywhere. What did I do wrong?

Edit: In the meantime, I found a derivation for the $\tan$ equation based on the bilinear transform: https://ccrma.stanford.edu/~jos/pasp/Classic_Virtual_Analog_Phase.html. Since I was interested in a derivation from the digital domain, I'm adding this as a sidenote rather than another answer.

  • $\begingroup$ 90° phase shift is actually the asymptotic limit you can get for a 1st-order filter. APF or not. Depending on the polarity you put into your APF, you get 90° phase shift either at DC or at Nyquist. $\endgroup$ Commented Dec 1, 2023 at 3:20
  • $\begingroup$ @robertbristow-johnson Wouldn't it be 180° for a 1st order 360° for 2nd order? $\endgroup$
    – wolframw
    Commented Dec 1, 2023 at 7:20
  • $\begingroup$ My brain does forget things. Yes, the APF does double the phase shift you get from the corresponding LPF. $\endgroup$ Commented Dec 1, 2023 at 9:04

2 Answers 2


The math is a bit of a slog here.

Let's start with

$$H(z) = \frac{a+z^{-1}}{1+az^{-1}} \tag{1}$$

On the unit circle this becomes

$$H(\omega) = \frac{a+e^{-j\omega}}{1+ae^{-j\omega}} \tag{2}$$

where $\omega$ is the normalized frequency $\omega = 2\pi\frac{f}{f_s}$ where $f_s$ is the sample rate.

Let's do one extra step by pulling out $e^{-j\omega/2}$ of both the numerator and the denominator.

$$ H(\omega) = \frac{e^{-j\omega/2}}{e^{-j\omega/2}}\cdot \frac{ae^{j\omega/2}+e^{-j\omega/2}}{e^{j\omega/2}+ae^{-j\omega/2}} = \frac{ae^{j\omega/2}+e^{-j\omega/2}}{e^{j\omega/2}+ae^{-j\omega/2}}\tag{3}$$

We can now see that the numerator is the conjugate complex of the denominator and we can write the whole thing as

$$H(\omega) = \frac{Y(\omega)}{Y^*(\omega)} \tag{4} $$

where $Y(\omega) = ae^{j\omega/2}+e^{-j\omega/2}$

Equation (4) conveniently proves that this is indeed an allpass, i.e. $|H(\omega)| = \frac{|Y(\omega)|}{|Y^*(\omega)|} =1$. For the phase we get

$$\angle{H} = \angle{Y} - \angle{Y^*} = \angle{Y} + \angle{Y} = 2\angle{Y} \tag{5}$$

If we want to find $\angle{H(\omega_0)} = -\pi/2$ we need to solve for $\angle{Y(\omega_0)} = -\pi/4$

Let's break down $Y$ into its real and imaginary parts.

$$Y(\omega) = ae^{j\omega/2}+e^{-j\omega/2} = \\ a\cos(\omega/2)+ja\sin(\omega/2) + \cos(\omega/2)-j\sin(\omega/2) = \\ \cos(\omega/2)(a+1)+j\sin(\omega/2)(a-1) \tag{6}$$

At the "crossover" frequency $\omega_0$ we have $\angle{Y(\omega_0)} = -\pi/4$ which means that the imaginary part is the negative of the real part. We get

$$\cos(\omega_0/2)(a+1) = - \sin(\omega_0/2)(a-1) \tag{7}$$

Separating the trigonometric functions we get

$$ \frac{\sin(\omega_0/2)}{\cos(\omega_0/2)} = \frac{1+a}{1-a} = \tan(\omega_0/2) \tag{8}$$

And now we can finally solve for $a$

$$a = \frac{\tan(\omega_0/2) -1}{\tan(\omega_0/2) +1} \tag{10}$$

(which may be a rough approximation to $-\frac{\tan\left(\pi\frac{f_\mathrm{c}}{f_\mathrm{s}}\right)-1}{\tan\left(\pi\frac{f_\mathrm{c}}{f_\mathrm{s}}\right)+1}$, but I am not sure).

This is indeed the correct answer.

An alternative way to solve this would be to split $H(\omega)$ into its real and imaginary parts and then solve for $\Re (H(\omega)) = 0$ since the real part at a phase of 90 degree is zero.

That requires solving the quadratic equation

$$a^2\cos(\omega_0) +2a+\cos(\omega_0) = 0 \tag{11}$$

and results in

\begin{align} a &= \sqrt{\frac{1}{\cos^2(\omega_0)}-1} - \frac{1}{\cos(\omega_0)} \tag{12}\\ &= \tan(\omega_0) - \frac{1}{\cos(\omega_0)}\\ &= \frac{\sin(\omega_0)-1}{\cos(\omega_0)} \\ &= \frac{2\sin(\omega_0/2)\cos(\omega_0/2) - 1}{\cos^2(\omega_0/2) - \sin^2(\omega_0/2)}\\ &= \frac{2\tan(\omega_0/2) - \sec^2(\omega_0/2)}{1 - \tan^2(\omega_0/2)}\\ &= \frac{2\tan(\omega_0/2) - (1 + \tan^2(\omega_0/2))}{1 - \tan^2(\omega_0/2)}\\ &= \frac{-(1 - \tan(\omega_0/2))^2}{(1 - \tan(\omega_0/2))(1 + \tan(\omega_0/2))}\\ &= \frac{\tan(\omega_0/2) - 1}{\tan(\omega_0/2) + 1} \tag*{$\blacksquare$} \end{align}

which is also the correct answer (although it's yucky at $\omega_0 = \pi/2$). So apparently the expression in equations (10) and (12) are actually the same, but the level of trigonometric Kung-Fu required to proof this is beyond me :-)

  • 1
    $\begingroup$ I was bored, so I thought I'd try to figure out the trigonometry. It's a little tortured, so feel free to make it simpler. $\endgroup$
    – Peter K.
    Commented Dec 1, 2023 at 16:25
  • $\begingroup$ I like the $$ \tag*{$\blacksquare$} $$ $\endgroup$ Commented Dec 1, 2023 at 17:53
  • $\begingroup$ //"At the "crossover" frequency $\omega_0$ we have $\angle{Y(\omega_0)} = -\pi/4$ which means that the imaginary part is the negative of the real part."// - - - - Actually, we know that the real part must be positive and the imaginary part is the negative of that. Otherwise you get the ambiguity of the real part negative and the imaginary part being positive. $\endgroup$ Commented Dec 1, 2023 at 17:58
  • 1
    $\begingroup$ @robertbristow-johnson. It's called a Halmos after Paul Halmos who used the black square at the end of his proofs to mean "QED". $\endgroup$
    – Peter K.
    Commented Dec 1, 2023 at 22:01
  • 1
    $\begingroup$ @PeterK. Your trig ninja skill are clearly better than mine :-) $\endgroup$
    – Hilmar
    Commented Dec 2, 2023 at 17:13

The math becomes a lot easier if you use the formula for the frequency response instead of the formula for the phase. The frequency response of an allpass filter can be written as




we obtain


from which it follows that


I think Eq. $(4)$ is even a bit simpler and nicer than the original formula in Zölzer's book. By the addition formula of the tangent function it's straightforward to show that both formulas are equivalent.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.