Options (Affects News & Product results only):

 OS: Any Format: Any Include: ProductsDevelopersNewsForumsVideos
Quick Search KVR

"Quick Search" KVR Audio's Product Database, News Items, Developer Listings, Forum Topics and videos here. For advanced Product Database searching please use the full product search. For the forum you can use the phpBB forum search.

To utilize the power of Google you can use the integrated Google Site Search.

Products 0

Developers 0

News 0

Forum 0

Videos 0

Search

## All Pass Filter coefficient formula

DSP, Plug-in and Host development discussion.
KVRist

426 posts since 11 Jul, 2004, from Southern California, USA
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φ)) = -11 - 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?
KVRist

426 posts since 11 Jul, 2004, from Southern California, USA
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φ)) = -11 - 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.
KVRian

911 posts since 30 Nov, 2003, from tejas
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
KVRAF

3648 posts since 8 Mar, 2004, from Berlin, Germany
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
KVRist

426 posts since 11 Jul, 2004, from Southern California, USA
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.
KVRian

911 posts since 30 Nov, 2003, from tejas
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
Previous

Moderator: Moderators (Main)