What is KVR Audio? | Submit News | Advertise | Developer Account

Options (Affects News & Product results only):

OS:
Format:
Include:
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.

Moderator: Moderators (Main)

KVRist
 
425 posts since 11 Jul, 2004, from Southern California, USA
 

Postby MackTuesday; Fri Jun 12, 2009 7:41 pm

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

Postby MackTuesday; Fri Jun 12, 2009 8:40 pm

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

Postby pj geerlings; Fri Jun 12, 2009 10:43 pm

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
 

Postby Robin from www.rs-met.com; Sat Jun 13, 2009 9:11 am

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
Image
KVRist
 
425 posts since 11 Jul, 2004, from Southern California, USA
 

Postby MackTuesday; Sat Jun 13, 2009 1:06 pm

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

Postby pj geerlings; Sun Jun 14, 2009 6:30 am

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)

Return to DSP and Plug-in Development