Plug-ins, Hosts, Apps,
Hardware, Soundware
Developers
(Brands)
Videos Groups
Whats's in?
Banks & Patches
Download & Upload
Music Search
KVR
   
KVR Forum » DSP and Plug-in Development
Thread Read
All Pass Filter coefficient formula
Goto page Previous  1, 2
MackTuesday
KVRist
- profile
- pm
- e-mail
- www
PostPosted: Fri Jun 12, 2009 7:41 pm reply with quote
Okay, here we go again: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.(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(g² + 1) / 2g = exp(-i)?????????? What is wrong with me? Why can't I do this problem?
^ Joined: 11 Jul 2004  Member: #32838  Location: Southern California, USA
MackTuesday
KVRist
- profile
- pm
- e-mail
- www
PostPosted: Fri Jun 12, 2009 8:40 pm reply with quote
MackTuesday wrote:
Okay, here we go again:
Quote:
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:H = (1 - g/z) / (g - 1/z)Again setting z = exp(-iφ) and H = -1:(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.
^ Joined: 11 Jul 2004  Member: #32838  Location: Southern California, USA
pj geerlings
KVRian
- profile
- pm
- e-mail
PostPosted: Fri Jun 12, 2009 10:43 pm reply with quote
All righty then ...

I think this is it :
rTheta = rFreq * krPi * rInvSmplRate;   
rD     = tan(rTheta);
rG     = (1.0 - rD) / (1.0 + rD);

peace y'all
pj
^ Joined: 30 Nov 2003  Member: #10706  Location: Newport Beach CA USA
Robin from www.rs-met.com
KVRAF
- profile
- pm
- e-mail
- www
PostPosted: Sat Jun 13, 2009 9:11 am reply with quote
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
----
^ Joined: 08 Mar 2004  Member: #15959  Location: Berlin, Germany
MackTuesday
KVRist
- profile
- pm
- e-mail
- www
PostPosted: Sat Jun 13, 2009 1:06 pm reply with quote
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.
^ Joined: 11 Jul 2004  Member: #32838  Location: Southern California, USA
pj geerlings
KVRian
- profile
- pm
- e-mail
PostPosted: Sun Jun 14, 2009 6:30 am reply with quote
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
^ Joined: 30 Nov 2003  Member: #10706  Location: Newport Beach CA USA
All times are GMT - 8 Hours

Printable version
Page 2 of 2
Goto page Previous  1, 2
Display posts from previous:   
ReplyNew TopicPrevious TopicNext Topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Username: Password:  
KVR Developer Challenge 2012