Skip to main content

Poll

FIR or IIR? Linear phase or minimum phase?

  • Minimum phase IIR
    5 (50%)
  • Minimum phase FIR
    0 (0%)
  • Linear phase FIR
    4 (40%)
  • Other (please specify in reply)
    1 (10%)

Total Members Voted: 28

Topic: Best kind of digital EQ filter? (Read 18518 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • Joe Bloggs
  • [*][*][*][*]
Best kind of digital EQ filter?
An audio company that I have some influence over is designing a new digital audio player and programming the digital EQ section.  Their engineer told me that they're implementing it as an FIR filter.  They're planning to play back hi-res music files up to 192k/24b on a somewhat dated SoC.  I see two potential problems:

1. 192000Hz audio requires a LOT of taps in an FIR filter to get at the low frequencies.  Frequency resolution is calculated as (Fs/N(taps)), so even a 2048 tap FIR filter can only get down to 100Hz or so.  Not much of a bass boost filter, more like a midbass bloat effect.
2. The company director was also complaining of "phase shift" with digital filters.  Now as you may know, corrective EQ filters are best implemented as minimum phase filters to cancel out the phase shift introduced by the headphones themselves, but FIR filters tend to be implemented as linear phase.  However linear phase looks better on paper and sounds better to... somebody?

I suggested that they change the design to a minimum phase IIR filter, but the engineer said "isn't FIR supposed to be higher fidelity?"  Where I have yet to get his word on what this "higher fidelity" entails.
I searched and found this:
http://www.dspguru.com/dsp/faqs/iir/basics
1.4 What are the advantages of IIR filters (compared to FIR filters)?

    IIR filters can achieve a given filtering characteristic using less memory and calculations than a similar FIR filter.

1.5 What are the disadvantages of IIR filters (compared to FIR filters)?

        They are more susceptable to problems of finite-length arithmetic, such as noise generated by calculations, and limit cycles. (This is a direct consequence of feedback: when the output isn't computed perfectly and is fed back, the imperfection can compound.)
        They are harder (slower) to implement using fixed-point arithmetic.
        They don't offer the computational advantages of FIR filters for multirate (decimation and interpolation) applications.

Now, I suspect that neither of the first two disadvantages apply, since they told me they're implementing their existing filter using 64-bit arithmetic.  That sounds like plenty enough accuracy, and 64-bit has got to be floating point, I guess?

But what does the last point mean?

And can someone offer me some examples of how much more noise / distortion an IIR filter would generate compared to an FIR filter given the same bit precision in calculations?

Best kind of digital EQ filter?
Reply #1
The last point refers to sampling rate conversion, so it is not applicable to your case. For a basic EQ, IIR filters should not have any problems with precision.

  • saratoga
  • [*][*][*][*][*]
Best kind of digital EQ filter?
Reply #2
This is what we based the EQ in rockbox on:  http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt

FWIW, this is an IIR filter as they are much faster on low power, fixed point hardware.  We would not have had the CPU available to implement an FIR system.

For audio, linear phase would be ideal.  You can't do this with IIR of course, but there are designs that get reasonably close.  I think minimum phase designs are often used, but I'm not an expert on this.

Best kind of digital EQ filter?
Reply #3
I would not say that linear-phase EQs are better, in terms of quality, than nonlinear-phase ones. Preferences differ among sound engineers.

  • saratoga
  • [*][*][*][*][*]
Best kind of digital EQ filter?
Reply #4
I would not say that linear-phase EQs are better, in terms of quality, than nonlinear-phase ones. Preferences differ among sound engineers.


In an ideal world why would you want anything other than linear phase?

  • Joe Bloggs
  • [*][*][*][*]
Best kind of digital EQ filter?
Reply #5
I would not say that linear-phase EQs are better, in terms of quality, than nonlinear-phase ones. Preferences differ among sound engineers.


In an ideal world why would you want anything other than linear phase?


Because
1. linear phase EQ leads to pre-ringing and post-ringing in equal proportions, when human hearing is much more sensitive to the former (people here of all places should know that! 
2. as I pointed out in the OP, sound transducers (especially headphones) are often near minimum-phase systems such that compensating their response at the output stage with a minimum-phase EQ leads to improvement in phase response as well as magnitude response.

But I don't know what would happen if someone decides to take Beats headphones and apply another 15dB bass boost instead... 

  • DVDdoug
  • [*][*][*][*][*]
Best kind of digital EQ filter?
Reply #6
I know a little about DSP (I have a couple of DSP books), but I'm not a DSP expert...

I'd leave the details to your DSP programmer.    It's not hard to make a filter that's better than human hearing (where any artifacts are inaudible).   

But, there are no perfect filters in hardware or software.    There are trade-offs.   People tend the get the idea that a digital (software) filter can be perfect.  The big difference between hardware & software filter design is that it costs more money to make a more-complex hardware filter, but in software (or firmware) additional complexity is free.  And in hardware, additional filter stages usually introduce additional noise, and you can run into voltage-headroom limitations, etc.

There are sometimes reasons for making a minimum-phase design, and there may be advantages to optimizing something else...  You can't hear phase-shift, unless you phase-shift the left channel without phase-shifting the right channel, or perhaps if the phase-shift is extreme.  There have been experiments with all-pass filters (filters that introduce different phase shifts at different frequencies without changing frequency response).  As far as I know, only "audiophiles" can hear a difference and they can only hear a difference in non-blind listening tests. 

If you are doing real-time DSP, processing-power could be a limitation.    And for example, you may have to make certain compomises if you don't have a floating-point processor, etc.

Quote
...since they told me they're implementing their existing filter using 64-bit arithmetic. That sounds like plenty enough accuracy, and 64-bit has got to be floating point, I guess?
Floating-point is prefered because there is a lot of summation in DSP and you need the ability to handle big numbers.  But it hat may depend on your hardware, so I'm not sure what you are using....  Maybe your hardware works better with 64-bit integers. 

In a hardware-player, you may have a floating-point processor.  That doesn't mean you can't use floating point, but there is more processing required to handle floating-point with an integer processor.

32-bit floating point is more than enough.    But, 64-bit floating might be used because you have a 64-bit processor and a 64-bit operating system and "Why not?", or for marketing and "keeping up with the competition".
  • Last Edit: 07 November, 2013, 01:24:29 PM by DVDdoug

Best kind of digital EQ filter?
Reply #7
There have been experiments with all-pass filters (filters that introduce different phase shifts at different frequencies without changing frequency response).  As far as I know, only "audiophiles" can hear a difference and they can only hear a difference in non-blind listening tests.

Phase shifts between linear-phase and nonlinear-phase EQs can be easily heard when the EQ curve is steep and the shift happens in the audible range. With steep frequency responses, like notch filtering of hum, ringing becomes a significant concern.

Best kind of digital EQ filter?
Reply #8
A 32-bit FP format does not always have sufficient precision for IIR filtering at low frequencies. When dealing with low frequencies, a 64-bit double internal precision is preferred.

  • saratoga
  • [*][*][*][*][*]
Best kind of digital EQ filter?
Reply #9
I would not say that linear-phase EQs are better, in terms of quality, than nonlinear-phase ones. Preferences differ among sound engineers.


In an ideal world why would you want anything other than linear phase?


Because
1. linear phase EQ leads to pre-ringing and post-ringing in equal proportions, when human hearing is much more sensitive to the former (people here of all places should know that! 
2. as I pointed out in the OP, sound transducers (especially headphones) are often near minimum-phase systems such that compensating their response at the output stage with a minimum-phase EQ leads to improvement in phase response as well as magnitude response.


I don't see how either of these follow that you'd want minimum phase.  For 1, the degree of ringing is a design choice anyway, and for 2 you're assuming that you know the dispersion in speakers.  Just choosing minimum phase does not imply that you've chosen the correct response to linearize the speaker's response, or even that you necessarily want to.  Generally my take is that speakers are probably designed without an EQ, and trying to tweak their phase response to some abstractly defined ideal is not necessarily a benefit. 

I think for a given scenario, its probably a better idea to minimize dispersion.  Or at least its a safer idea unless the user has a very specific goal in mind. 

Best kind of digital EQ filter?
Reply #10
I've once used the vst plugin analyser by  christian w budde,  and I noticed that the "group delay" jump to big values  when eq-ing lows in minimum phase mode.  I'm unsure if  that the "group delay" value  is more representative than  " phase shift", regarding audible differences  (if you have some information regarding that matter , you are welcome).  Otherwise  I've done  more subjective experiments, and I preferred "linear phase" mode , when eq-ing lows  with fast-paced music , such like psytrance.

So far I've decided  to use eqs this way: ( I combine two eq if I want ).
- linear phase for the lows (let's say below 200 hz)
- minimum phase everywhere else.
Or I just avoid to eq below 200 hz, and  just use minimum phase (perhaps the best solution ?) .

Otherwise the "popular" opinion I've  noticed at kvraudio, is  to avoid  to eq in "linear phase" mode . What I've understood, is that linear phase mode somehow degrade the transients , because it adds "pre echos" at the begin of them,  while "post echos" are not noticed (or are perceived as more "natural").

Oh and also an  advantage I've noticed with "linear phase" eq, is that you can use them to split sound into two separate frequency bands  easily.
And perhaps "linear phase" is better, if you wish to eq mid & side  or left & right separately (since there's no delay introduced between channels).
  • Last Edit: 07 November, 2013, 01:44:55 PM by extrabigmehdi

  • saratoga
  • [*][*][*][*][*]
Best kind of digital EQ filter?
Reply #11
I've once used the vst plugin analyser by  christian w budde,  and I noticed that the "group delay" jump to big values  when eq-ing lows in minimum phase mode.  I'm unsure if  that the "group delay" value  is more representative than  " phase shift",


Group delay == delay.  If the speed of light in your audio cables is .66*c, then 1 uS of group delay == 200 meters of extra (lossless) cable. 

A group delay corresponds to a linear increase in phase shift with frequency, hence a linear phase filter has only a group delay and no phase distortion. 

  • Joe Bloggs
  • [*][*][*][*]
Best kind of digital EQ filter?
Reply #12
So the advice for the engineer, if he has 64 bit float arithmetic at his disposal but otherwise limited CPU grunt, is to do minimum phase IIR?
What if it's 64bit integer instead of float?

They just intend to implement a 10 band graphic EQ btw.

Part of me is actually hoping they'd go for broke with FIR filtering as I could then suggest to them an option to replace the 10-band EQ with a custom convolution impulse 

Best kind of digital EQ filter?
Reply #13
1. linear phase EQ leads to pre-ringing and post-ringing in equal proportions, when human hearing is much more sensitive to the former (people here of all places should know that! 

Exactly.

Quote
2. as I pointed out in the OP, sound transducers (especially headphones) are often near minimum-phase systems such that compensating their response at the output stage with a minimum-phase EQ leads to improvement in phase response as well as magnitude response.

That too.

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.

--Ethan
I believe in Truth, Justice, and the Scientific Method

Best kind of digital EQ filter?
Reply #14
A group delay corresponds to a linear increase in phase shift with frequency, hence a linear phase filter has only a group delay and no phase distortion.


Well I  used an analyzer (the one from  christian w budde)  on different "linear phase" eq.
For all these linear phase eq, the analyzer indicated that the group delay was set to a  fixed value across all frequencies , or nul  (so basically it would just mean there's just a fixed delay) .  However, for some of these eq, the phase shift increase regularly with frequency, while for other it remains nul ; I don't know if this have any particular meaning .
Anyway my question was , if it wasn't more pertinent to talk of "group delays" instead of "phase shift" regarding audible problems.

@Ethan Winer
Quote
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.

I  thought that in the particular case of fast-paced electronic , that I  prefer to boost the bass with LP. I've posted once a precise example at kvraudio, and it just seemed to make  some of  these people angry. They explained  me  that I  should boost the bass to much lesser amount ,  and with  a  much smoother slope (which actually is an other way to reduce the audibility of these "phase shift").

  • sshd
  • [*][*][*]
Best kind of digital EQ filter?
Reply #15
2048 FIR taps is not a lot.

I am using 6-channel 131.072 taps FIR filters generated by Audiolense.

  • markanini
  • [*][*][*][*][*]
Best kind of digital EQ filter?
Reply #16
Theres a killer test I stumbled upon that involves nothching out a pulsing sine wave. Between the IIR-mininum FIR-mininum and FIR-linear modes avaliable in ElectriQ vst plugin IIR-mininum produced the smoothest result, FIR-linear had insane amounts of both pre-and post echo.

  • 2Bdecided
  • [*][*][*][*][*]
  • Developer
Best kind of digital EQ filter?
Reply #17
An audio company
...needs to hire someone who understands digital filtering before they can call themselves that (unless they only do analogue equipment!).

The audibility of filter ringing is discussed in this thread...
http://www.hydrogenaudio.org/forums/index....mp;#entry604471
...and the samples are still available.

Cheers,
David.

Best kind of digital EQ filter?
Reply #18
FIR-linear had insane amounts of both pre-and post echo.


Insane ? I don't know which eq you are using (try fabfilter pro or psp neon hr) , but for me it require careful listening, to notice any "pre-echo" (well for a "regular" eq use) , and actually I don't hear it that way, more like a (tiny) smearing.  And by the way, FIR  has less "post echo" than IIR, it's just that the "echo" is distributed equally before and after transients, which ensure that from "the average", there's no phase shift. (While for IIR , there's only post-echo, it's asymmetric, hence the phase shift).
  • Last Edit: 08 November, 2013, 06:53:37 AM by extrabigmehdi

  • markanini
  • [*][*][*][*][*]
Best kind of digital EQ filter?
Reply #19
Insane ? I don't know which eq you are using (try fabfilter pro or psp neon hr) , but for me it require careful listening, to notice any "pre-echo" (well for a "regular" eq use) , and actually I don't hear it that way, more like a (tiny) smearing.  And by the way, FIR  has less "post echo" than IIR, it's just that the "echo" is distributed equally before and after transients, which ensure that from "the average", there's no phase shift. (While for IIR , there's only post-echo, it's asymmetric, hence the phase shift).

Yes, insane amounts. The plugin I tested is revealed in the same post you are replying to. Your reponce begs the question, why question the implementation when you can easily generate the test signal and put your esteemed linear phase EQs through their paces? I'm sure many would like to know if this turns out to be a bad implementation of linear phase in a pretty highly regarded EQ plugin.
  • Last Edit: 08 November, 2013, 07:10:16 AM by markanini

Best kind of digital EQ filter?
Reply #20
Insane ? I don't know which eq you are using (try fabfilter pro or psp neon hr) , but for me it require careful listening, to notice any "pre-echo" (well for a "regular" eq use) , and actually I don't hear it that way, more like a (tiny) smearing.  And by the way, FIR  has less "post echo" than IIR, it's just that the "echo" is distributed equally before and after transients, which ensure that from "the average", there's no phase shift. (While for IIR , there's only post-echo, it's asymmetric, hence the phase shift).

Yes, insane amounts. The plugin I tested is revealed in the same post you are replying to. Your reponce begs the question, why question the implementation when you can easily generate the test signal and put your esteemed linear phase EQs through their paces? I'm sure many would like to know if this turns out to be a bad implementation of linear phase in a pretty highly regarded EQ plugin.


Ooops I've overlooked you mentioned Electri-Q.  Well, I'll study this with a particular example later.


  • markanini
  • [*][*][*][*][*]
Best kind of digital EQ filter?
Reply #21
Another case for minimum phase; Ask any pro mixing engineer what he uses to notch out unwanted resonances in live tracks. They will always mention an IIR minimum phase EQ like Waves Q10.

  • saratoga
  • [*][*][*][*][*]
Best kind of digital EQ filter?
Reply #22
An audio company
...needs to hire someone who understands digital filtering before they can call themselves that (unless they only do analogue equipment!).

The audibility of filter ringing is discussed in this thread...
http://www.hydrogenaudio.org/forums/index....mp;#entry604471
...and the samples are still available.



Thats an awesome link that I somehow missed.  I admit, my experience with filters is not for audio mostly, so I could be wrong, but here is what I think I understand:

1)  Ringing is a problem if you have very steep filter transition bands
2)  A linear phase system will tend to have more ringing because of the requirement that the impulse response be symmetric.
3)  EQ systems tend to use relatively gradual filters.  I know for Rockbox we default to a Q of 1 and a smooth roll off.  This is fine because spectral leakage is acceptable/desirable. 

Given 3, is ringing actually a problem in a linear (or at least not-minimum) phase EQ?  I would think the actual tradeoff in practice would be between efficiency and frequency dispersion, with minimum phase maximizing the former, and linear phase the latter.  Or are people really building 5 Hz wide, -30dB EQ filters (maybe 50/60hz notch??) and I'm just not aware of it?


  • knutinh
  • [*][*][*][*][*]
Best kind of digital EQ filter?
Reply #23
I would be sceptical about an "audio engineer" that claimed that linear phase was the best with no disclaimers.

1. What is your model of the "error" that you are trying to correct
2. What is your model of human perception
3. What are the practical details in your application (delay requirements, computation structure etc)

I believe that IIR filters tend to be disproportionally inefficient on things like x86: the number of mult/adds are less relevant than the number of N-element SIMD operations that can be done simultaneously.

If you are correcting minimum phase errors, then a minimum phase equalizer will correct phase distortion "for free".

If you are doing creative spectral modifications, then a linear-phase EQ will do them without messing with phase.

Humans tends to be sensitive to pre-ringing, less so to post-ringing.

Perhaps the "optimal" shape depends on if you are doing very sharp & deep "spectral removal" (phase response close to the stop band might not matter?), while moderate boosts/shelving filters might be more sensitive to phase behaviour.

I am not an EQ designer. If asked to place a bet, I would bet on some (unknown) intermediate form in-between linear phase and minimum phase for general EQ tasks. I.e. not the symmetric, very long delay linear-phase shape, and not the typical "left-heavy" minimum phase response, but some moderately asymmetric response.

-k
  • Last Edit: 08 November, 2013, 03:41:02 PM by knutinh

Best kind of digital EQ filter?
Reply #24
1)  Ringing is a problem if you have very steep filter transition bands

Yes. Steep filtering is not uncommon, think of notch filters for hum removal.

2)  A linear phase system will tend to have more ringing because of the requirement that the impulse response be symmetric.

Linear-phase systems have less measured ringing, but more audible ringing, because a significant part of their ringing is pre-ringing.

3)  EQ systems tend to use relatively gradual filters.

Yes, unless you need steep cuts for restoration purposes (like hum removal) or steep resonances for special effects.