IPB

Welcome Guest ( Log In | Register )

3 Pages V  < 1 2 3  
Reply to this topicStart new topic
Best kind of digital EQ filter?, FIR or IIR? Linear phase or minimum phase?
Best kind of digital EQ filter?
You cannot see the results of the poll until you have voted. Please login and cast your vote to see the results of this poll.
Total Votes: 27
Guests cannot vote 
xnor
post Nov 10 2013, 20:38
Post #51





Group: Developer
Posts: 387
Joined: 29-April 11
From: Austria
Member No.: 90198



QUOTE (Alexey Lukin @ Nov 10 2013, 19:30) *
Yes, linear-phase filters have to be somewhat longer than minimum-phase filters to achieve the same specification for the frequency response. However the amplitude of ringing is lower in linear-phase filters.


It's not only somewhat, but much longer if you want a clean filter. The decay of a min phase filter is faster, and the IIR will decay down to zero essentially while with a FIR you have to truncate at some point (else the filter would be extremely long) and apply a window function, which changes the frequency response.


2nd order min phase IIR, -30 dB at 60 Hz, Q=6, Fs=192k vs linear phase FIR. The plot shows 20*log10(abs(filter_output)):


Higher amplitude ringing that has the main energy concentrated near an impulse is imo quite preferable to long pre- and post-ringing in the audible range of frequencies because of masking effects.

This post has been edited by xnor: Nov 10 2013, 20:43
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 10 2013, 21:09
Post #52





Group: Members
Posts: 190
Joined: 31-July 08
Member No.: 56508



Can you post these impulses as WAV files? Looking at the pics, it's hard for me to believe that these filters have the same frequency response.
Go to the top of the page
+Quote Post
knutinh
post Nov 10 2013, 21:15
Post #53





Group: Members
Posts: 568
Joined: 1-November 06
Member No.: 37047



QUOTE (Alexey Lukin @ Nov 10 2013, 14:15) *
QUOTE (knutinh @ Nov 10 2013, 07:07) *
I don't see any potential to roll out the loop as there is dependency between iterations.

If loading 5 out of 8 SIMD registers is not enough for you, there are several methods to speed it up:
1. run several filters in parallel,
2. remove the dependence between iterations,
3. run Intel IPP.

And remember that float may not be enough for IIR filtering at low frequencies, you may need double.

1. Sure
2. Would it still be a biquad?
3. Are you saying that Intel IPP does a single biquad employing more than 5/8? How?

-k
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 10 2013, 21:21
Post #54





Group: Members
Posts: 190
Joined: 31-July 08
Member No.: 56508



2. Yes, it would be numerically identical, albeit somewhat less stable.
3. Perhaps, I haven't measured, but IPP is probably much faster than what you can hand-write.
Go to the top of the page
+Quote Post
saratoga
post Nov 10 2013, 21:21
Post #55





Group: Members
Posts: 4718
Joined: 2-September 02
Member No.: 3264



QUOTE (Alexey Lukin @ Nov 10 2013, 13:57) *
Hmm, it could have been pulled from the recent version, not sure why. Try this version, it does work for me: rmaa6.zip.


This version works great. Thanks!
Go to the top of the page
+Quote Post
saratoga
post Nov 10 2013, 21:24
Post #56





Group: Members
Posts: 4718
Joined: 2-September 02
Member No.: 3264



QUOTE (knutinh @ Nov 10 2013, 16:15) *
1. Sure
2. Would it still be a biquad?
3. Are you saying that Intel IPP does a single biquad employing more than 5/8? How?


The point I was trying to make before is that one would never bother to SIMD such a low order filter for audio. The sample rate would have to be MHz before it would be worthwhile.

Usually the filters people SIMD are of larger order and thus much easier to SIMD on very wide vector systems like SSE4+.
Go to the top of the page
+Quote Post
xnor
post Nov 10 2013, 21:36
Post #57





Group: Developer
Posts: 387
Joined: 29-April 11
From: Austria
Member No.: 90198



QUOTE (Alexey Lukin @ Nov 10 2013, 22:09) *
Can you post these impulses as WAV files? Looking at the pics, it's hard for me to believe that these filters have the same frequency response.

minvslinear.7z

The FIR doesn't match the IIR exactly but it's pretty close.

This post has been edited by xnor: Nov 10 2013, 21:54
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 10 2013, 22:58
Post #58





Group: Members
Posts: 190
Joined: 31-July 08
Member No.: 56508



Thanks. I'm wondering if this is universal or happens because you are trying to approximate IIR filter with FIR. I know that when you go the other way convert lin-phase FIR to a min-phase FIR, the filter length does not change (i.e. the duration of ringing remains the same).
Go to the top of the page
+Quote Post
knutinh
post Nov 11 2013, 10:50
Post #59





Group: Members
Posts: 568
Joined: 1-November 06
Member No.: 37047



QUOTE (saratoga @ Nov 10 2013, 21:24) *
The point I was trying to make before is that one would never bother to SIMD such a low order filter for audio. The sample rate would have to be MHz before it would be worthwhile.

Usually the filters people SIMD are of larger order and thus much easier to SIMD on very wide vector systems like SSE4+.

I guess that is application-dependant. If you do some offline audio processing (e.g. lossy compression), you generally want it done as fast (and low power consumption) as possible. If some (granted small) sub-component can be optimised by 2:1, this might be worth it. If you do realtime processing, the penalty for high load can be high (missed deadline or increased latency to account for possible missed deadlines). In both cases, choosing filter structure based on the #mult can be a non-ideal proxy for choosing based on (realistic) complexity estimates for the given hardware/libraries.

The point that I tried to make was that the classical dsp measures of complexity (#multiplications per sample or per second) motivated by the (for the time significant) silicon area needed to implement a multiplication unit are becoming less relevant as modern architectures offers multiple cores, multiple-element vector units that does N multiplies in the same time as 1 multiply (or N additions). I believe that Intel (and even ARM) tend to spend a small fraction of the area/cost/power on floating-point multiplicators. The probably _could_ increase that count, but various issues (typical application load, typical compiler smartness etc) makes that a bad business proposition.

Thus the question is not "what filter do I choose that minimise the number of mults for a given filtering task", but "what filter do I choose that minimise total system load/cycle count/power draw/whatever performance metric for a given filtering task". Given that you have the unusual luxury of being able to write optimal code for some platform. In practice, it may boil down to "what can IPP/equivalents do for me with the least possible effort"

-k

This post has been edited by knutinh: Nov 11 2013, 11:11
Go to the top of the page
+Quote Post
knutinh
post Nov 11 2013, 11:49
Post #60





Group: Members
Posts: 568
Joined: 1-November 06
Member No.: 37047



QUOTE (Alexey Lukin @ Nov 10 2013, 22:58) *
... I know that when you go the other way convert lin-phase FIR to a min-phase FIR, the filter length does not change (i.e. the duration of ringing remains the same).

What is it that you convert, and how do you define "duration of ringing"?

I did a simple MATLAB test, designing some linear phase filter, inverting maximum-phase zeros to have a minimum-phase FIR filter of the same magnitude response. Total impulse response length remains equal, but how do you quantify "duration of ringing" in a way that gives a number <inf for IIR filters? Some "effective" number ala RT60?

When you "render" a filter spec into an actual filter, you loose information about the design objectives. I would assume that designing the final filter directly would come closer to the real goals of some application, rather than design a linear filter, then transform it into some other form?
http://www.dspguru.com/dsp/howtos/how-to-d...ase-fir-filters
CODE
N=11;
F = [0 0.4 0.6 1];
A = [1 1 0 0];
b = firpm(N, F, A);
a = 1;
[b,a] = eqtflength(b,a);
[z,p,k] = tf2zp(b,a);
z(abs(z)>1) = 1./z(abs(z)>1);
[b2,a2] = zp2tf(z,p,k);
b2 = b2.*(sum(b)/sum(b2));%normalize DC gain

[H,W] = freqz(b,a,512);
[H2,W2] = freqz(b2,a2,512);

figure(1)
zplane(b)

figure(2)
stem(b)

figure(3)
semilogx(W,20*log10(abs(H)))
axis tight
grid on

figure(4)
zplane(b2)

figure(5)
stem(b2)

figure(6)
semilogx(W,20*log10(abs(H2)))
axis tight
grid on


This post has been edited by knutinh: Nov 11 2013, 11:54
Go to the top of the page
+Quote Post
xnor
post Nov 11 2013, 15:02
Post #61





Group: Developer
Posts: 387
Joined: 29-April 11
From: Austria
Member No.: 90198



QUOTE (Alexey Lukin @ Nov 10 2013, 23:58) *
Thanks. I'm wondering if this is universal or happens because you are trying to approximate IIR filter with FIR. I know that when you go the other way — convert lin-phase FIR to a min-phase FIR, — the filter length does not change (i.e. the duration of ringing remains the same).

No that's impossible since more energy is stored right after the impulse with min phase. Maybe you're just looking at the number of taps being output by some algorithm, but that has nothing to do with the filter's performance.

I don't see a difference if going into the other direction. Well, there is one: if using the 60 Hz filter from above as prototype a simple 2nd order IIR matches the FIR better than the other way around (due to truncation... 262k taps doesn't seem enough ...).

This post has been edited by xnor: Nov 11 2013, 15:08
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 11 2013, 20:29
Post #62





Group: Members
Posts: 190
Joined: 31-July 08
Member No.: 56508



QUOTE (xnor @ Nov 11 2013, 10:02) *
No that's impossible since more energy is stored right after the impulse with min phase. Maybe you're just looking at the number of taps being output by some algorithm...

Of course not! I'm looking at the decay rate of actual ringing, not at the number of taps. And I have already given an example of a filter that I'm talking about, see post #48. I'm attaching a pair of filters, in case you want to analyze: linminphase.zip.
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 11 2013, 20:34
Post #63





Group: Members
Posts: 190
Joined: 31-July 08
Member No.: 56508



QUOTE (knutinh @ Nov 11 2013, 06:49) *
What is it that you convert, and how do you define "duration of ringing"?

I'm looking at the decay rate, it is easy to see in graphs posted by xnor.
Go to the top of the page
+Quote Post
xnor
post Nov 11 2013, 22:30
Post #64





Group: Developer
Posts: 387
Joined: 29-April 11
From: Austria
Member No.: 90198



QUOTE (Alexey Lukin @ Nov 11 2013, 21:29) *
Of course not! I'm looking at the decay rate of actual ringing, not at the number of taps. And I have already given an example of a filter that I'm talking about, see post #48. I'm attaching a pair of filters, in case you want to analyze: linminphase.zip.


Regardless of ringing, in the case of such a lowpass in the audio range you should choose min phase over linear phase (or at list a mix towards min) due to potentially audible pre-ringing except if you have very special requirements.

How did you design this filter? What IIR order is it, if applicable?

This post has been edited by xnor: Nov 11 2013, 23:51
Go to the top of the page
+Quote Post
saratoga
post Nov 11 2013, 23:09
Post #65





Group: Members
Posts: 4718
Joined: 2-September 02
Member No.: 3264



QUOTE (knutinh @ Nov 11 2013, 05:50) *
QUOTE (saratoga @ Nov 10 2013, 21:24) *
The point I was trying to make before is that one would never bother to SIMD such a low order filter for audio. The sample rate would have to be MHz before it would be worthwhile.

Usually the filters people SIMD are of larger order and thus much easier to SIMD on very wide vector systems like SSE4+.

I guess that is application-dependant. If you do some offline audio processing (e.g. lossy compression), you generally want it done as fast (and low power consumption) as possible. If some (granted small) sub-component can be optimised by 2:1, this might be worth it. If you do realtime processing, the penalty for high load can be high (missed deadline or increased latency to account for possible missed deadlines).


I think you're not understanding how trivial the filter you proposed is. You're looking at << 1MHz/mbit/s output. For a mid range Core i5 system, to run it at as fast as possible using plain scalar ops would require reading in PCM data at something like 5-10 Gbit/s. You're need an SSD RAID array just to feed that filter! You could process an entire CD in a fraction of a second. On each of your cores. SIMD would be pointless, you wouldn't be able to feed the filter fast enough to keep up smile.gif

QUOTE (knutinh @ Nov 11 2013, 05:50) *
The point that I tried to make was that the classical dsp measures of complexity (#multiplications per sample or per second)


I posted actual benchmarks above for a 2 pole/zero filter on ARM above. I'm not assuming, I'm telling you how fast these things actually run!
Go to the top of the page
+Quote Post
saratoga
post Nov 11 2013, 23:11
Post #66





Group: Members
Posts: 4718
Joined: 2-September 02
Member No.: 3264



QUOTE (knutinh @ Nov 11 2013, 06:49) *
I did a simple MATLAB test, designing some linear phase filter, inverting maximum-phase zeros to have a minimum-phase FIR filter of the same magnitude response. Total impulse response length remains equal, but how do you quantify "duration of ringing" in a way that gives a number <inf for IIR filters? Some "effective" number ala RT60?


exp(-1) is very widely used for quantifying the decay of filters. I'd use that unless there was a compelling reason to use something else.
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 12 2013, 08:56
Post #67





Group: Members
Posts: 190
Joined: 31-July 08
Member No.: 56508



QUOTE (xnor @ Nov 11 2013, 17:30) *
How did you design this filter? What IIR order is it, if applicable?

The lin-phase FIR filter was designed from a frequency response of some analog filter with 48 dB/oct decay. If I recall correctly, it's been a Butterworth filter of order 6. The min-phase FIR filter has been designed by finding a min-phase response for the same frequency response using a Hilbert transform.
Go to the top of the page
+Quote Post
mynameismeech
post Dec 4 2013, 09:09
Post #68





Group: Members
Posts: 1
Joined: 4-December 13
Member No.: 112893



QUOTE (Ethan Winer @ Nov 7 2013, 14:05) *
To me it's a no-brainer to never use a linear phase filter. As far as I can tell, linear phase equalizers were developed in response to the "phase shift is damaging" nonsense spewed endlessly by misinformed audio magazine writers. The myth that phase shift is a problem was repeated so many times over the years that audio gear makers came up with a way to avoid phase shift, just to use as a marketing claim. The problem is LP filters are audibly worse than minimum phase! You can't always hear the pre-ringing, but often you can depending on the frequency and other settings.


There is one real world example I occasionally encounter where a linear phase eq is useful. An all pass filter isn't audible by itself, but if you use an all pass filter on one track and layer that track against another, then the difference is extremely audible. A good example would be to layer kick drums ... add an all pass filter to just one kick drum and you can affect the combined sound in a very audible way. Likewise, eq-ing the low frequencies of a single kick drum can occasionally introduce enough phase shift to be audible not in isolation, but when combined with other kick drums. So if your 808 kick was already in phase with your other kick/bass tracks perfectly and you wanted to take out some 60 hz, a minimum phase eq would introduce phase shift and maybe some odd cancellation against another track, and you can use a linear phase eq to avoid the problem.

This is admittedly a very rare case and I've never used it in a song, but I have used all-pass filters to get kick drums to sit against each other better.

smile.gif
Go to the top of the page
+Quote Post
knutinh
post Dec 4 2013, 09:37
Post #69





Group: Members
Posts: 568
Joined: 1-November 06
Member No.: 37047



QUOTE (Alexey Lukin @ Nov 10 2013, 21:21) *
IPP is probably much faster than what you can hand-write.

IPP is (in some ways) like a compiler: it needs to solve a (set of) generic problems that is sufficiently "wide" so as to be useful for many users, yet sufficiently "narrow" so as to allow the low-level gurus to do their thing. And AFAIK, they solve that generic problem really, really well, across a range of intel platforms. If what you need is to solve that generic problem, you probably don't want to compete with Intel.

If, however, your problem deviate from the general case in any way, there is a window of opportunity to beat IPP. For a IIR filter, this might be things like precision requirements, knowledge about coefficients, knowledge about frame sizes, targeting a single cpu architecture etc. Solving specific problems is a lot easier than solving general problems.

While software developers often fall in the trap of "over-generalization" (writing code to handle every possible future requirement), I am talking about "degeneralization" (solving what needs to be solved now and nothing else).

-k

This post has been edited by knutinh: Dec 4 2013, 09:40
Go to the top of the page
+Quote Post
Canar
post Dec 4 2013, 19:14
Post #70





Group: Super Moderator
Posts: 3327
Joined: 26-July 02
From: princegeorge.ca
Member No.: 2796



QUOTE (Alexey Lukin @ Nov 10 2013, 10:30) *
Wheee! A chance to finally ask a question I've been wondering since forever but never knew how to phrase.

There are two functions depicted in this image (perhaps only approximately, but whatever, context). The first is sinc, which extends to infinity in both directions. The second is what? It extends to infinity only in one direction.


--------------------
∑:<
Go to the top of the page
+Quote Post
Alexey Lukin
post Dec 4 2013, 22:17
Post #71





Group: Members
Posts: 190
Joined: 31-July 08
Member No.: 56508



I don't know if any closed-form expression exists for this function. Strictly speaking, a perfect sinc does not have a min-phase variant only an approximation. In my example, it is a minimum-phase filter which can be obtained from a linear-phase filter by either spectral factorization or complex cepstrum folding.
Go to the top of the page
+Quote Post

3 Pages V  < 1 2 3
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th April 2014 - 09:21