DSPRelated.com
Forums

Linear phase vs Min. Phase

Started by Max October 18, 2014
On Saturday, October 18, 2014 10:42:53 PM UTC-4, Max wrote:
> On Sat, 18 Oct 2014 16:30:35 -0700 (PDT), robert bristow-johnson > <rbj@audioimagination.com> wrote: > > >On Saturday, October 18, 2014 9:34:14 AM UTC-4, Max wrote: > >> Is there a good method for > >> achieving linear phase while avoiding pre-ring? > > >instead of using the equi-ripple Parks-McClellan alg to design the brick-wall FIR filter, use the least-squares design.\ > > > >the P-McC method puts in ripples in the pass-band that have the appearance of being sinusoidal. so it looks like multiplying in the frequency domain by > > > > ( 1 + a*cos(2*pi*f/f0) ) > > > >where a is hopefully small and f0 is the spacing of the bumps in the ripple. now, if it's doing that, what is the effect in the time-domain? you get a blip on both sides of the central lobe in the impulse response. one is a pre-echo, the other is a post-echo. > > Hmmm.... Do you think that this would correct the problem then, > Robert?
it will correct the problem of pre-echo only to the extent that it "corrects" the post-echo, since it remains linear phase and a symmetrical impulse response. but yeah. the reason why you're getting *both* the pre- and post-echo is because of ripples in the pass band. because of the nature of P-McC, which is based on the Remes Exchange Algorithm, which is a minimax error alg, there *will* *necessarily* be ripples to the extent that you spec the tolerance of error. but the firls() counterpart method in MATLAB does not necessarily put in ripples because it's not trying to minimize the *maximum* error as does firpm(), but firls() minimizes the mean square error.
> I've been seeing an increasing buzz about abandoning linear > phase filters due to the pre-ring problem.
well, with minimum-phase, there is no pre-ring because there is no "pre-" to the main lobe of the impulse response at all. but if constant delay, for all frequencies passed, is important to you, you have to go with linear phase. but, just because it's linear phase, it does not mean it has to have echos. but whatever post-echo there is with linear phase, there will necessarily have the same amount of pre-echo, because, with linear phase, the impulse response is symmetrical about the main lobe.
> I've seen plugin > manufacturers' videos on Youtube demoing differences with their new > minimal phase approach. > > It sounds like the problem can be -minimized- by use of minimal phase > filters in place of linear phase, but that is based purely on moving > artifacts from the front of the signal to the back, hoping that they > will be masked.
from the front of the impulse response to the back.
> > In any case, this would seem to dispel any notion of completely > accurate reproduction of signals 'just as long as they comply with > Nyquist.' Certainly there must be something missing here.
the completely accurate reproduction of the Nyquist-bandlimited signal that gets sampled happens to the degree that you can implement a brick-wall low-pass filter. with more and more delay, we can get closer and closer to the ideal brick-wall LPF.
> I can't imagine that the audio industry could have overlooked > this for so long.
there's a lotta things they overlook. there are reasons for bothering with linear phase and reasons not to bother with linear phase. r b-j
On Mon, 20 Oct 2014 11:33:24 -0400, Max <Max@sorrynope.com>
wrote:

>On Sun, 19 Oct 2014 13:02:33 GMT, N0Spam@daqarta.com (Bob Masta) >wrote: > >>I personally think the pre-ring "problem" is overblown. >>People focus on it because it looks bad, not because it is >>audible. See my "Gibbs Phenomenon" topic at >><http://www.daqarta.com/dw_gggg.htm> for a scope photo and >>some numerical observations. >> >>Basically, on a typical sound card sampling at 48 kHz, the >>"ring" waveform is at about 20 kHz or so. It's true that >>some prople can detect 20 kHz at high levels in a threshold >>test, but that's a far cry from what we are dealing with >>pre-ring. To observe a pre-ring you need a low-frequency >>square wave (I used 2 kHz in the scope shot). > >Hi Bob, > >I appreciate your comments on the web page (looks like a cool >program!). I have always thought that using the 20Khz figure as the >upper limit for human hearing was very optimistic, so I agree with you >there. > >The major concern though is the burst of artifacts before the onset of >a percussive signal. IOW, the attack of a snare drum is 'intended' to >occur where the sinc-like coefficients peak, in the center of a linear >phase FIR filter. But given the required number of filter stages, >there can be a pre-event of audible duration. Some describe it as >phase-smear. > >Given that it happens before the attack, there is no masking. In >fact, filter plugin designers have been using minimum phase filters >instead of linear phase in order to move the artifacts to the trailing >edge where they presumably will be masked. Still amounts to >corruption of the audio signal, but apparently that's the only >available option. > >It's very audible in the samples at the link I had posted. The 'bell' >sample may be way over-emphasized, but the last couple samples may be >representative of what can happen with real EQ. And the fact that >this occurs at all opens some new questions about sample rates and >filtering methods. I'm turning up some interesting stuff on this now >that I've got some good search keys (apodizing filters, for example)
Max: I may have misunderstood your question. I (rashly) assumed you were talking about the pre-ring of anti-aliasing filters, but I see that the link you posted is talking about equalization, where the cutoff is well into the audible range. Whole 'nother kettle of fish! Sorry for the confusion. Best regards, Bob Masta DAQARTA v7.60 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE Signal Generator, DaqMusiq generator Science with your sound card!
On Tue, 21 Oct 2014 13:18:42 GMT, N0Spam@daqarta.com (Bob Masta)
wrote:

>>It's very audible in the samples at the link I had posted. The 'bell' >>sample may be way over-emphasized, but the last couple samples may be >>representative of what can happen with real EQ. And the fact that >>this occurs at all opens some new questions about sample rates and >>filtering methods. I'm turning up some interesting stuff on this now >>that I've got some good search keys (apodizing filters, for example)
>I may have misunderstood your question. I (rashly) assumed >you were talking about the pre-ring of anti-aliasing >filters, but I see that the link you posted is talking about >equalization, where the cutoff is well into the audible >range. Whole 'nother kettle of fish! Sorry for the >confusion.
Hi Bob, Actually I was speaking about filters in general, but I'm interested in how this is avoided in anti-aliasing filters. I assumed that the anti-aliasing filter would exhibit the same behavior as the mid-band filters in those sound samples, albeit for shorter duration due to the rolloff frequency. Is that not correct?
On Mon, 20 Oct 2014 15:42:10 +0000 (UTC), glen herrmannsfeldt
<gah@ugcs.caltech.edu> wrote:

> Max wrote: >> In fact, I've seen people ridiculed by the pro engineer crowd for >> using higher bit rates to record. > >Well, now that one can make very nice oversampling digital filters, >it isn't at all hard to do.
Glen, is the problem easily avoidable with oversampling filters? If so, I wonder why all the discussion lately about apodizing filters and avoidance of linear phase filters.
On Mon, 20 Oct 2014 12:09:07 -0500, "mnentwig" <24789@dsprelated>
wrote:

>>> Is there a good method for achieving linear phase while avoiding >pre-ring? > >Yes, simply give a numeric solver the task to design a FIR filter with x >seconds group delay and the magnitude response of your choice. > >Now the result is not _exactly_ linear phase, in the same way as the >designed filter (usually) does not implement the exact requested frequency >response. >But increasing the number of taps gets you as close as you like.
Would you mind elaborating on that? When you refer to a 'numeric solver' for dealing with this, are there examples or apps that you can point to?
On Wed, 22 Oct 2014 08:06:27 -0400, Max <Max@sorrynope.com>
wrote:

>On Tue, 21 Oct 2014 13:18:42 GMT, N0Spam@daqarta.com (Bob Masta) >wrote: > >>>It's very audible in the samples at the link I had posted. The 'bell' >>>sample may be way over-emphasized, but the last couple samples may be >>>representative of what can happen with real EQ. And the fact that >>>this occurs at all opens some new questions about sample rates and >>>filtering methods. I'm turning up some interesting stuff on this now >>>that I've got some good search keys (apodizing filters, for example) > >>I may have misunderstood your question. I (rashly) assumed >>you were talking about the pre-ring of anti-aliasing >>filters, but I see that the link you posted is talking about >>equalization, where the cutoff is well into the audible >>range. Whole 'nother kettle of fish! Sorry for the >>confusion. > >Hi Bob, > >Actually I was speaking about filters in general, but I'm interested >in how this is avoided in anti-aliasing filters. I assumed that the >anti-aliasing filter would exhibit the same behavior as the mid-band >filters in those sound samples, albeit for shorter duration due to the >rolloff frequency. Is that not correct?
Since the cutoff frequency for an anti-aliasing filter is above the audible range (for most folks anyway, and probably *especially* for those involved in the music scene due to cumulative loud exposures), the "ring" at the cutoff is inaudible. Nobody (even a young kid) is very sensitive in this range compared to the normal speech/music range, and the Gibbs phenomenon (the pre/post ring) is only about 9% of the total... about 15 dB below the fundamental of a square wave. Since you only see the Gibbs effect on transients, and since transients have lots of harmonics, you can't detect this tiny added amount against the wall of harmonics (even if you are a young kid who still has hair cells in the 20 kHz range). Best regards, Bob Masta DAQARTA v7.60 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE Signal Generator, DaqMusiq generator Science with your sound card!
On Wed, 22 Oct 2014 12:22:47 GMT, N0Spam@daqarta.com (Bob Masta)
wrote:

>On Wed, 22 Oct 2014 08:06:27 -0400, Max <Max@sorrynope.com> >wrote:
>>Hi Bob, >> >>Actually I was speaking about filters in general, but I'm interested >>in how this is avoided in anti-aliasing filters. I assumed that the >>anti-aliasing filter would exhibit the same behavior as the mid-band >>filters in those sound samples, albeit for shorter duration due to the >>rolloff frequency. Is that not correct? > >Since the cutoff frequency for an anti-aliasing filter is >above the audible range (for most folks anyway, and probably >*especially* for those involved in the music scene due to >cumulative loud exposures), the "ring" at the cutoff is >inaudible. Nobody (even a young kid) is very sensitive in >this range compared to the normal speech/music range, and >the Gibbs phenomenon (the pre/post ring) is only about 9% of >the total... about 15 dB below the fundamental of a square >wave. Since you only see the Gibbs effect on transients, >and since transients have lots of harmonics, you can't >detect this tiny added amount against the wall of harmonics >(even if you are a young kid who still has hair cells in the >20 kHz range).
Hi Bob, Here's my own impression from what I've read so far, and from those audio mid-band samples: There is a pre-echo that spans many sample intervals. This would seem logical given the number of filter elements in front of the center/peak in a linear phase filter. Given that humans spacial perception involves left-right phase differences of around 10 microseconds, the CD sampling rate is already on the edge. But given that the 'phase smear' extends over multiple samples, that would be a significant time interval even at 44.1khz. That is apparently why filter designers have started using minimal phase filters for pro audio apps. FabFilter and others have Youtube video docs on the subject. But of course minimal phase has separate disadvantages. You're the DSP engineer, so there's a significant chance that I am overlooking something. :-) I'm still researching the replies posted here (thanks to all!), but I wanted to make sure I'm on the right track before this thread goes too stale.
Max <Max@sorrynope.com> wrote:

(snip, I wrote)
>>Well, now that one can make very nice oversampling digital filters, >>it isn't at all hard to do.
> Glen, is the problem easily avoidable with oversampling filters? If > so, I wonder why all the discussion lately about apodizing filters and > avoidance of linear phase filters.
Well, what I really meant was that you can generate really huge digital filters for relatively low cost. One has to actually figure out what kind of filter one wants, and balance the cost tradeoffs for an actual product. (People might choose on model over another based on a few dollars/euros/xxx difference in price.) When CD players first came out, they were expensive, used fairly expensive lasers, and so could afford fancy analog filters. As laser prices dropped, so did CD players, and also the cost of the filters. There is little economy of scale for an analog RLC filter, but a lot for a big digital filter in an ASIC. -- glen
On Thu, 23 Oct 2014 00:31:47 +0000 (UTC), glen herrmannsfeldt
<gah@ugcs.caltech.edu> wrote:

>Max <Max@sorrynope.com> wrote: > >(snip, I wrote) >>>Well, now that one can make very nice oversampling digital filters, >>>it isn't at all hard to do. > >> Glen, is the problem easily avoidable with oversampling filters? If >> so, I wonder why all the discussion lately about apodizing filters and >> avoidance of linear phase filters. > >Well, what I really meant was that you can generate really huge digital >filters for relatively low cost. One has to actually figure out what >kind of filter one wants, and balance the cost tradeoffs for an actual >product. (People might choose on model over another based on a few >dollars/euros/xxx difference in price.) > >When CD players first came out, they were expensive, used fairly >expensive lasers, and so could afford fancy analog filters. >As laser prices dropped, so did CD players, and also the cost >of the filters. > >There is little economy of scale for an analog RLC filter, but >a lot for a big digital filter in an ASIC. > >-- glen
Hi Glen, I thought that you may have been referring specifically to reducing the time-span of pre-ring by upsampling and moving the anti-alias filter to a higher corner. That would presumably require some type of very intelligent interpolation. I have seen that mentioned as a solution, but never quite understood how it could be achieved without generating its own set of artifacts, especially if the sample rate were increased many-fold.
On Wed, 22 Oct 2014 19:18:35 -0400, Max <Max@sorrynope.com>
wrote:

>On Wed, 22 Oct 2014 12:22:47 GMT, N0Spam@daqarta.com (Bob Masta) >wrote: > >>On Wed, 22 Oct 2014 08:06:27 -0400, Max <Max@sorrynope.com> >>wrote: > >>>Hi Bob, >>> >>>Actually I was speaking about filters in general, but I'm interested >>>in how this is avoided in anti-aliasing filters. I assumed that the >>>anti-aliasing filter would exhibit the same behavior as the mid-band >>>filters in those sound samples, albeit for shorter duration due to the >>>rolloff frequency. Is that not correct? >> >>Since the cutoff frequency for an anti-aliasing filter is >>above the audible range (for most folks anyway, and probably >>*especially* for those involved in the music scene due to >>cumulative loud exposures), the "ring" at the cutoff is >>inaudible. Nobody (even a young kid) is very sensitive in >>this range compared to the normal speech/music range, and >>the Gibbs phenomenon (the pre/post ring) is only about 9% of >>the total... about 15 dB below the fundamental of a square >>wave. Since you only see the Gibbs effect on transients, >>and since transients have lots of harmonics, you can't >>detect this tiny added amount against the wall of harmonics >>(even if you are a young kid who still has hair cells in the >>20 kHz range). > >Hi Bob, > >Here's my own impression from what I've read so far, and from those >audio mid-band samples: There is a pre-echo that spans many sample >intervals. This would seem logical given the number of filter >elements in front of the center/peak in a linear phase filter. Given >that humans spacial perception involves left-right phase differences >of around 10 microseconds, the CD sampling rate is already on the >edge. But given that the 'phase smear' extends over multiple samples, >that would be a significant time interval even at 44.1khz. That is >apparently why filter designers have started using minimal phase >filters for pro audio apps. FabFilter and others have Youtube video >docs on the subject. But of course minimal phase has separate >disadvantages. > >You're the DSP engineer, so there's a significant chance that I am >overlooking something. :-) I'm still researching the replies posted >here (thanks to all!), but I wanted to make sure I'm on the right >track before this thread goes too stale.
First off, I don't think it's fair to compare audio equalization filters (whith cutoffs in the middle of the audible spectrum) with anti-aliasing filters having band-limit cutoffs.. Second, I haven't looked at (hardware-type) scope responses of those mid-band equalizers to actually see what "before" and "after" look like. However, I have shown you a scope response of a typical anti-aliased square wave. Note that there is nothing you could call a "pre-echo"; the "ring" starts right at the rising (or falling) edge, exactly at the time it would be least audible due to masking. So whatever the equalizer guys are doing, it's not equivalent to anti-aliasing at all if there is anything like a pre-echo (a transient that appears before the original transient). Off the top of my head, I can't guess how you would create a pre-echo with an FIR-type structure... it seems like you'd need a separate delay just for the "pre", not a simple sum of all taps as in a conventional FIR. But then it's not something I've given a great deal of thought to! Best regards, Bob Masta DAQARTA v7.60 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE Signal Generator, DaqMusiq generator Science with your sound card!