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 
Joe Bloggs
post Nov 7 2013, 17:06
Post #1





Group: Members
Posts: 375
Joined: 29-September 01
Member No.: 55



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?
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 7 2013, 17:20
Post #2





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



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.
Go to the top of the page
+Quote Post
saratoga
post Nov 7 2013, 17:28
Post #3





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



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.
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 7 2013, 18:02
Post #4





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



I would not say that linear-phase EQs are better, in terms of quality, than nonlinear-phase ones. Preferences differ among sound engineers.
Go to the top of the page
+Quote Post
saratoga
post Nov 7 2013, 18:46
Post #5





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



QUOTE (Alexey Lukin @ Nov 7 2013, 13:02) *
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?
Go to the top of the page
+Quote Post
Joe Bloggs
post Nov 7 2013, 19:01
Post #6





Group: Members
Posts: 375
Joined: 29-September 01
Member No.: 55



QUOTE (saratoga @ Nov 8 2013, 01:46) *
QUOTE (Alexey Lukin @ Nov 7 2013, 13:02) *
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! smile.gif
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... huh.gif
Go to the top of the page
+Quote Post
DVDdoug
post Nov 7 2013, 19:12
Post #7





Group: Members
Posts: 2565
Joined: 24-August 07
From: Silicon Valley
Member No.: 46454



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. wink.gif

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".

This post has been edited by DVDdoug: Nov 7 2013, 19:24
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 7 2013, 19:26
Post #8





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



QUOTE (DVDdoug @ Nov 7 2013, 14:12) *
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.
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 7 2013, 19:30
Post #9





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



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.
Go to the top of the page
+Quote Post
saratoga
post Nov 7 2013, 19:39
Post #10





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



QUOTE (Joe Bloggs @ Nov 7 2013, 14:01) *
QUOTE (saratoga @ Nov 8 2013, 01:46) *
QUOTE (Alexey Lukin @ Nov 7 2013, 13:02) *
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! smile.gif
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.
Go to the top of the page
+Quote Post
extrabigmehdi
post Nov 7 2013, 19:43
Post #11





Group: Members
Posts: 408
Joined: 15-August 09
Member No.: 72330



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).

This post has been edited by extrabigmehdi: Nov 7 2013, 19:44
Go to the top of the page
+Quote Post
saratoga
post Nov 7 2013, 19:54
Post #12





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



QUOTE (extrabigmehdi @ Nov 7 2013, 14:43) *
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.
Go to the top of the page
+Quote Post
Joe Bloggs
post Nov 7 2013, 20:03
Post #13





Group: Members
Posts: 375
Joined: 29-September 01
Member No.: 55



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 biggrin.gif
Go to the top of the page
+Quote Post
Ethan Winer
post Nov 7 2013, 20:05
Post #14





Group: Members
Posts: 248
Joined: 12-May 09
From: New Milford, CT
Member No.: 69730



QUOTE (Joe Bloggs @ Nov 7 2013, 13:01) *
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! smile.gif

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
Go to the top of the page
+Quote Post
extrabigmehdi
post Nov 7 2013, 23:40
Post #15





Group: Members
Posts: 408
Joined: 15-August 09
Member No.: 72330



QUOTE (saratoga @ Nov 7 2013, 18:54) *
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").
Go to the top of the page
+Quote Post
sshd
post Nov 8 2013, 11:14
Post #16





Group: Members
Posts: 207
Joined: 16-June 03
Member No.: 7218



2048 FIR taps is not a lot.

I am using 6-channel 131.072 taps FIR filters generated by Audiolense.
Go to the top of the page
+Quote Post
markanini
post Nov 8 2013, 12:33
Post #17





Group: Members
Posts: 550
Joined: 22-December 03
From: Malmö, Sweden
Member No.: 10615



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.
Go to the top of the page
+Quote Post
2Bdecided
post Nov 8 2013, 12:37
Post #18


ReplayGain developer


Group: Developer
Posts: 5089
Joined: 5-November 01
From: Yorkshire, UK
Member No.: 409



QUOTE (Joe Bloggs @ Nov 7 2013, 17:06) *
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.
Go to the top of the page
+Quote Post
extrabigmehdi
post Nov 8 2013, 12:51
Post #19





Group: Members
Posts: 408
Joined: 15-August 09
Member No.: 72330



QUOTE (markanini @ Nov 8 2013, 11:33) *
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).

This post has been edited by extrabigmehdi: Nov 8 2013, 12:53
Go to the top of the page
+Quote Post
markanini
post Nov 8 2013, 13:04
Post #20





Group: Members
Posts: 550
Joined: 22-December 03
From: Malmö, Sweden
Member No.: 10615



QUOTE (extrabigmehdi @ Nov 8 2013, 12:51) *
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. smile.gif

This post has been edited by markanini: Nov 8 2013, 13:10
Go to the top of the page
+Quote Post
extrabigmehdi
post Nov 8 2013, 14:08
Post #21





Group: Members
Posts: 408
Joined: 15-August 09
Member No.: 72330



QUOTE (markanini @ Nov 8 2013, 12:04) *
QUOTE (extrabigmehdi @ Nov 8 2013, 12:51) *
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. smile.gif


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

Go to the top of the page
+Quote Post
markanini
post Nov 8 2013, 15:59
Post #22





Group: Members
Posts: 550
Joined: 22-December 03
From: Malmö, Sweden
Member No.: 10615



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.
Go to the top of the page
+Quote Post
saratoga
post Nov 8 2013, 18:30
Post #23





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



QUOTE (2Bdecided @ Nov 8 2013, 07:37) *
QUOTE (Joe Bloggs @ Nov 7 2013, 17:06) *
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?

Go to the top of the page
+Quote Post
knutinh
post Nov 8 2013, 21:37
Post #24





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



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

This post has been edited by knutinh: Nov 8 2013, 21:41
Go to the top of the page
+Quote Post
Alexey Lukin
post Nov 8 2013, 21:42
Post #25





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



QUOTE (saratoga @ Nov 8 2013, 13:30) *
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.

QUOTE (saratoga @ Nov 8 2013, 13:30) *
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.

QUOTE (saratoga @ Nov 8 2013, 13:30) *
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.
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: 23rd August 2014 - 19:46