All Pass Filter coefficient formula

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Okay, here we go again:

Code: Select all

H = (1/g - 1/z) / (g - 1/z)
 = (1 - g/z) / (g² - g/z)
OKAY. Now we restrict z to the unit circle and require H = -1.

Code: Select all

(1 - g∙exp(-iφ)) / (g² - g∙exp(-iφ)) = -1
1 - g∙exp(-iφ) = -g² + g∙exp(-iφ)
g² + 1 = 2g∙exp(-iφ)
exp(-iφ) = (g² + 1) / 2g
-iφ = ln [(g² + 1) / 2g]
φ = i ln [(g² + 1) / 2g]
WHAT THE HELL? In order for φ to be real, the logarithm must evaluate to -i??? So

Code: Select all

(g² + 1) / 2g = exp(-i)
?????????? What is wrong with me? Why can't I do this problem?

Post

MackTuesday wrote:Okay, here we go again:
H = (1/g - 1/z) / (g - 1/z)
= (1 - g/z) / (g² - g/z)
Okay, clearly I just don't know what I'm doing. Because the damn magnitude response for the above is 1/g, not 1. So I was right in the first place:

Code: Select all

H = (1 - g/z) / (g - 1/z)
Again setting z = exp(-iφ) and H = -1:

Code: Select all

(1 - g∙exp(-iφ)) / (g - exp(-iφ)) = -1
1 - g∙exp(-iφ) = -g + exp(-iφ)
g + 1 = (g + 1)∙exp(-iφ)
exp(-iφ) = 1
φ = 0
This is true no matter what g is. If you're getting phase inversion anywhere other than zero frequency, there's probably something wrong with your implementation. There. I'm done. Finished. Finito. Complete. No more. Goodbye.

Post

All righty then ...

I think this is it :

Code: Select all

rTheta = rFreq * krPi * rInvSmplRate;   
rD     = tan(rTheta);
rG     = (1.0 - rD) / (1.0 + rD);

peace y'all
pj

Post

http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt says:

w0 = 2*pi*f0/Fs
alpha = sin(w0)/(2*Q)

b0 = 1 - alpha
b1 = -2*cos(w0)
b2 = 1 + alpha
a0 = 1 + alpha
a1 = -2*cos(w0)
a2 = 1 - alpha

...as you see, with biquad allpass filters, you have an additional degree of freedom: Q, which determines how steep the slope of the phase response is, when it passes through -180 degrees
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

Robin from www.rs-met.com wrote:http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt says:

w0 = 2*pi*f0/Fs
alpha = sin(w0)/(2*Q)

b0 = 1 - alpha
b1 = -2*cos(w0)
b2 = 1 + alpha
a0 = 1 + alpha
a1 = -2*cos(w0)
a2 = 1 - alpha

...as you see, with biquad allpass filters, you have an additional degree of freedom: Q, which determines how steep the slope of the phase response is, when it passes through -180 degrees
This corroborates what I was saying. You might be able to get phase inversion away from w0 = 0 with a biquad allpass, but not with a single pole and zero.

Post

Guys!

A while back I wrote a simple VST effect called "PhaserTst" - I've already verified the formula I gave above using this test scaffold and it works as close to perfect as I need...

Currently I use a mix of low-level white noise and nine octaves of sinewaves as input to the plugin - the plugin simply combines the "phased" signal and the dry signal and then I look at the output in a spectrum analyzer for frequency dips. It was this plugin that provided the original empirical data and subsequently verified the final formula.

peace,
pj

Post Reply

Return to “DSP and Plugin Development”