FIR filters

Re: FIR filters

I then used the Hilbert Transform, minimum phase filter design approach to create the impulse responses for each band.

Also, a colleague here in Sydney showed me how using two IDFT's per gaussian band - with one as is and the other pre-multiplied by complex "i" for a 90 deg phase shift - gives two impulse responses that can be combined to create a nice envelope follower.

Hi Michael,

We may be going off in slightly different directions so I'll try to clarify. When I used the term Hilbert transform, which likely I should not have, I was trying to account for the generation of the analytic signal upon transforming back to the time domain, as the Hilbert transform relates the real and imaginary parts of an analytic signal. This has nothing to do with using the Hilbert transform to relate the log magnitude and phase of a minimum phase system. I'll take another crack at the recipe.

Start with the impulse response, let's call it h.

Take the DFT of h of size N and call it H.

Put the positive frequency values of H in one end of an array G of size M where M > N (I've been using M = 8*N). The rest of G is filled with 0s. This has two effects when G gets transformed back: the signal is upsampled by M/N (sinc interpolation) and the time domain result will be an analytic signal since the negative frequency values in H were set to 0. This second effect is the implicit "Hilbert transform".

For each frequency band{

Multiply G with that band's Gaussian window.

Take the IDFT of the product, which is a complex signal in the time domain.

Plot the log magnitude.
}

I can send you the R code, for what it's worth, but you can probably code this up in Matlab in about 10 minutes.

Best,

--Frank
 
Re: FIR filters

Sorry Mark. I'm was using the terms a little loosely.

Just to clarify, I meant running an IIR filter in both directions gives the same magnitude response as having run it twice in one direction, but the filter's effective phase response is linear. It's like using a FIR filter with symmetric coefficients from -inf to +inf time but with the computational efficiency of two IIR's. Clearly not possible realtime. :-)

Filtering something, by convolving it with anything, then reversing time and doing it again, results in zero phase. It's not about IIR or FIR.

Regarding frequency domain processing... FIR filters can be implemented directly in the time domain, which is computationally expensive, or using transforms (DFT/FFT's). The two methods are, on most processors, essentially numerically identical. Textbook transform based filtering has block latency which is a function of the transform size. Check out
https://en.wikipedia.org/wiki/Overlap–save_method
https://en.wikipedia.org/wiki/Overlap–add_method
For realtime processing of anything longer than short filters, the latency often isn't tolerable. With the Huron workstation, Lake DSP developed algorithms for very efficient, very low latency filtering using very long FIR filters.

Haha, you make it sound so easy ;-) I've never seen an implementation of real-time processing in the FT domain, but I would assume the issues arise from reverseability of the FT operation. I think you are mistaken about which one is more computationally expensive for practical lengths, but the traditional FIR implementation are definitely delay expensive, and connected directly to the sample rate.

I do have a sample project from the now defunct Analog Devices automotive group from years ago if anyone is interested in checking it out.
 
Last edited:
Re: FIR filters

Hi Michael,

We may be going off in slightly different directions so I'll try to clarify. When I used the term Hilbert transform, which likely I should not have, I was trying to account for the generation of the analytic signal upon transforming back to the time domain, as the Hilbert transform relates the real and imaginary parts of an analytic signal. This has nothing to do with using the Hilbert transform to relate the log magnitude and phase of a minimum phase system. I'll take another crack at the recipe.

Start with the impulse response, let's call it h.

Take the DFT of h of size N and call it H.

Put the positive frequency values of H in one end of an array G of size M where M > N (I've been using M = 8*N). The rest of G is filled with 0s. This has two effects when G gets transformed back: the signal is upsampled by M/N (sinc interpolation) and the time domain result will be an analytic signal since the negative frequency values in H were set to 0. This second effect is the implicit "Hilbert transform".

For each frequency band{

Multiply G with that band's Gaussian window.

Take the IDFT of the product, which is a complex signal in the time domain.

Plot the log magnitude.
}

I can send you the R code, for what it's worth, but you can probably code this up in Matlab in about 10 minutes.

Best,

--Frank

Got it. I just tried it and it works. The band IR's all peak at the same time.

Sorry if you've covered this already. Why the up-sampling?
 
Re: FIR filters

Haha, you make it sound so easy ;-) I've never seen an implementation of real-time processing in the FT domain, but I would assume the issues arise from reverseability of the FT operation. I think you are mistaken about which one is more computationally expensive for practical lengths, but the traditional FIR implementation are definitely delay expensive, and connected directly to the sample rate.

One way to think of it is that the OLA and OLS convolution methods - links above - aren't really frequency domain methods. They just exploit properties of the Fourier transform (and it's fast implementation, the FFT) to reduce the number of multiplies it takes to compute the convolution. Direct convolution costs ~N multiplies per sample, where N is the FIR filter length. OLA and OLS transform methods take roughly log2(N) multiplies per sample. For a 512 length FIR, that's 512 multiplies per sample versus ~9 multiplies. For a processor (and ignoring parallel operations) that's about 25 mega cycles per second versus ~0.5 mega cps (and versus ~0.25 mega cps for a biquad) - all for ~48 kHz audio. (Adds and memory moves move these numbers around a bit but they're roughly in the ball park.)

As for examples of using transforms for convolution in audio, many convolutional reverbs use them, as does some signal processing in TV's, AVR's, portable devices....

Cheers,
----

Edit: Numbers corrected above.
 
Last edited:
Re: FIR filters

Why the up-sampling?

Good question. I remember that I originally put it in there to deal with what I thought was an aliasing problem with the Gaussian windows as they are not band-limited. One could window the window with a finite window, I suppose :roll: To the extent that the impulse response being analyzed is band limited there should not be significant aliasing but there could be with test signals, such as an ideal impulse.

Oversampling allows for time steps of less than 1 (input) sample, which makes for a prettier, though not more meaningful, display when expanding the time scale at high frequencies. On occasion I see what I think are artifacts at the high end of the range even with oversampling. There's something going on there I don't understand. Lot's of subtleties in this business...

Best,

--Frank
 
Re: FIR filters

Thx Peter, yep, when I built your DIYs it was with the goal of using them to finally take the time to learn about speakers in general , measurement techniques, smaart, system tuning, .......haha anything my mellon will allow.....

I'm thinking minidsp's opendrc-dr8 looks like a hell of a learning platform, and quite a bit more powerful than most commercial offereings.......https://www.minidsp.com/images/documents/OpenDRC-DA8 User Manual.pdf
See any hidden gotcha's with it ?
 
Re: FIR filters

Thx Peter, yep, when I built your DIYs it was with the goal of using them to finally take the time to learn about speakers in general , measurement techniques, smaart, system tuning, .......haha anything my mellon will allow.....

I'm thinking minidsp's opendrc-dr8 looks like a hell of a learning platform, and quite a bit more powerful than most commercial offereings.......https://www.minidsp.com/images/documents/OpenDRC-DA8 User Manual.pdf
See any hidden gotcha's with it ?

It looks like the maximum output voltage is only 2 Vrms - I think that will be a problem for Pro use. It also does not appear to have limiter functions ... but I maybe wrong.
 
Re: FIR filters

Good question. I remember that I originally put it in there to deal with what I thought was an aliasing problem with the Gaussian windows as they are not band-limited. One could window the window with a finite window, I suppose :roll: To the extent that the impulse response being analyzed is band limited there should not be significant aliasing but there could be with test signals, such as an ideal impulse.

Oversampling allows for time steps of less than 1 (input) sample, which makes for a prettier, though not more meaningful, display when expanding the time scale at high frequencies. On occasion I see what I think are artifacts at the high end of the range even with oversampling. There's something going on there I don't understand. Lot's of subtleties in this business...

Best,

--Frank

Got it. Thanks.

BTW I noticed too that for the lower frequency bands, the time domain response of the Gaussian can extend beyond the window length (at least in my Matlab simulations). And that's where your initial transform windowing may come into play (depending on the transform length). I.e. at the lowest bands, the band response may be dominated by the initial transform window, not the Gaussian.
 
Last edited:
Re: FIR filters

Back to the basics:

In theory, if a powered line array box used traditional DSP for EQ, Xovers, time alignment, etc. -and- then box was then upgraded to FIR filter processing, what would be the real world differences in sound quality?

I have been told it will be louder, by as much as 4-6dB. I assume this is because there is no phase cancelations from the FIR filter.
I am told the whole box sounds better in the horizontal plane. Again, I assume becuase of the lack of phase issues in a FIR filter.

Is this accurate? Any more real-world benefits of a FIR upgrade?
 
Re: FIR filters

Back to the basics:

In theory, if a powered line array box used traditional DSP for EQ, Xovers, time alignment, etc. -and- then box was then upgraded to FIR filter processing, what would be the real world differences in sound quality?

I have been told it will be louder, by as much as 4-6dB. I assume this is because there is no phase cancellations from the FIR filter.
I am told the whole box sounds better in the horizontal plane. Again, I assume because of the lack of phase issues in a FIR filter.

Is this accurate? Any more real-world benefits of a FIR upgrade?

I think I need to quote Ivan … “it depends” … probably the best real world example of what you can do with FIR filters with respect to sound quality is the difference between an EAW or Fulcum product when they are “focused” and when they are not.

Generally I would not expect an increase in SPL, but it is possible, a higher crossover slope may take some load off the compression driver and there could also be better summation between bands.

If the speaker components in a line-array are not physically symmetrical, as you move across the coverage pattern the lows and highs can phase cancel because arrival time from each of the divers changes as you move across the pattern (radiation error). If you use brick wall filters this problem can be greatly reduced.

Here are a couple of links that may be of interest
http://dolby.invisionzone.com/index.php?app=core&module=attach&section=attach&attach_id=8
http://dolby.invisionzone.com/index.php?app=core&module=attach&section=attach&attach_id=7

...and here is another (complicated) FIR trick ...
http://firmaker.afmg.eu/index.php/downloads.html
 

Attachments

  • radiation error.jpg
    radiation error.jpg
    250.5 KB · Views: 6
  • vue.jpg
    vue.jpg
    31.4 KB · Views: 6
Last edited:
Re: FIR filters

I have been told it will be louder, by as much as 4-6dB. I assume this is because there is no phase cancelations from the FIR filter.
I am told the whole box sounds better in the horizontal plane.

Not only that, but it will reduce the weight of the cabinet by half, and solve any performance issues you may be having in the bedroom. Also the subs will be in time at all audience positions.

Seriously, though, FIR is not magic. It will not make a box overall louder. Simply implementing some FIR filtering will also not necessarily improve polar coverage or sound quality. It could, but not everyone will use this filtering the same way, and in fact most use a combination of FIR and IIR filtering as it isn't realistic or desirable to apply FIR to every problem.

What is possible using FIR is an increase in peak SPL output, very short term. This is because in a normal signal processing chain the "ideal" signal is provided to the loudspeaker and the transducer/box then replays a band-limited and time-smeared version of it, which has lower crest factor and a less clean impulse. In effect FIR can be used to do the opposite, i.e. providing a smeared signal with lower crest factor to the speaker which the speaker then mangles back into perfect alignment, outputting a more perfect impulse than was put in! The potential increase is on the order of <3dB though, and will be evident mostly as a quality improvement rather than an increase in perceived loudness.
 
Re: FIR filters

Back to the basics:



I have been told it will be louder, by as much as 4-6dB. I assume this is because there is no phase cancelations from the FIR filter.
I am told the whole box sounds better in the horizontal plane. Again, I assume becuase of the lack of phase issues in a FIR filter.

Is this accurate? Any more real-world benefits of a FIR upgrade?
It often amazes me the stories that are told and then retold-without any evidence or truth.

This usually happens because of the lack of understanding of how things work in the first place.

The list of "audio myths" is quite long. But the truly sad thing is that some of them exist at the highest levels in our business.

And just because "so and so said it" it MUST be true. WHY?

Many stories are told and made up simply because it makes the teller feel "special" in some way. No matter how wrong or incorrect it is.

But until they are questioned or asked to prove it-it is perceived as "the truth".

Have you talked to any salesmen lately??????????????
 
Re: FIR filters

Back to the basics:

In theory, if a powered line array box used traditional DSP for EQ, Xovers, time alignment, etc. -and- then box was then upgraded to FIR filter processing, what would be the real world differences in sound quality?

Sean,

The effects of FIR range from the mundane to the esoteric. I'll do my best to cover the bases here.

I have been told it will be louder, by as much as 4-6dB. I assume this is because there is no phase cancelations from the FIR filter.
I am told the whole box sounds better in the horizontal plane. Again, I assume becuase of the lack of phase issues in a FIR filter.

Like many things there is an element of truth in both of these, but neither is totally accurate:
  • As for the first statement above, possibly the most esoteric feature of a "correctly" processed FIR box is what Bennett discusses. This is a cool consequence of physics that gets deeper into the world of what constitutes a signal.
  • In regards to a box sounding better in the horizontal plane, it is not that simple. Any time you have displaced sources in a given axis they will add in some locations, and subtract in others. FIR does not change this. An FIR can offer the ability execute a transition from two transducers to one more quickly, which can help alleviate this. Unfortunately the way that this was done historically, with brick wall HP and LP that can have some undesirable sonic artifacts (a long, long post). Today more reasonable approach would be a high order L-R class crossover that is preceded by an allpass class filter that pre-corrects the phase rotation introduced by the L-R filter.
  • Beyond these two effects, an FIR based filter typically offers much better frequency resolution to correct small behaviors than the typical IIR biquad filter we have used since the dawn of pro audio.
  • An FIR gives you complete freedom to consider frequency and phase behavior arbitrarily, limited only by the overall delay you are willing to incur.
  • Because FIR give you arbitrary control of the magnitude response, you can focus on aspects of product design with little thought to magnitude effects. An example might be using numerical simulation of the K-H integral to very precisely define wave propagation in a horn, without having to account for the horn's influence on the magnitude response.
  • To the product designer the FIR offers a real possibility of cost savings. As an example, you might be able to implement a passive crossover using a minimal number of reactive components (and no resistive components). Then you can drive the loudspeaker with a single amplifier channel and use the FIR to implement a loudspeaker whose performance is nearly the same as a classic biamped design, but with a lower overall bill of materials (BOM) cost.
  • Along this line the improvements in computing cost are making the use of DSP, be it FIR or IIR the most cost competitive way to implement filtering. Passives will increasingly become the millstone hanging around the designer's BOM.
 
Last edited:
Re: FIR filters

...Passives will increasingly become the millstone hanging around the designer's BOM.
[/LIST]

AAAArrg. You had me right up until the BOM! I hate initializations. So a quick google search gets me right to the point.
Bank of Melbourne. Bureau of Meteorology. Byte Order Mark.
 
Re: FIR filters

I think I need to quote Ivan … “it depends” … probably the best real world example of what you can do with FIR filters with respect to sound quality is the difference between an EAW or Fulcum product when they are “focused” and when they are not.

Generally I would not expect an increase in SPL, but it is possible, a higher crossover slope may take some load off the compression driver and there could also be better summation between bands.

Isn't the opposite also possible? That the end result is less output?
In the EAW case, my understanding from the link Bennett posted earlier is that the FIR is creating an *echo* signal, that cancels reflections as they come back to the mouth of the horn. Isn't this using more bandwidth and power to get less SPL?
 
Re: FIR filters

Just to add a "different twist" to the whole eq/phase issue.

Just because an eq adjust the phase DOES NOT always mean it is a bad thing.

If it is in a "problem area" then it could possibly help to have an eq that does not adjust phase.

HOWEVER-in many cases (where there is no overlap-multi arrivals etc) when you adjust the eq you ACTUALLY HELP the phase response to be flatter.

So "automatically" assuming that FIR is the "ultimate answer" is going down the wrong road.

As usual-it depends, and when a proper speaker design is done, you do NOT need FIR filters. Because there is nothing to "fix".

Or put another way-often "fancy filters" (of all types) are trying to fix something that is basically a bad/incorrect design.

If it was a better design, then you don't need the "fancy filters".

A "perfect speaker" will have a phase response that resembles a high and low pass filter.

"We'll fix it in the mix" has morphed into "We'll fix it with the DSP". Filters can be a useful tool or a terrible crutch. Designers should be transparent about their application, because knowledgeable end-users are armed with measurement tools and the internet.

Ivan- I would argue that a "perfect speaker" has a "perfect" phase response, DC to light.
 
Re: FIR filters

AAAArrg. You had me right up until the BOM! I hate initializations. So a quick google search gets me right to the point.
Bank of Melbourne. Bureau of Meteorology. Byte Order Mark.

"Bill of material"... actual analog components.

Further, real-world capacitors with near ideal performance at high current (like passive crossovers) are large and expensive.

I have long been an advocate of active speakers with "smart" electronics. There are many advantages and cost is coming down.

JR
 
Re: FIR filters

"We'll fix it in the mix" has morphed into "We'll fix it with the DSP". Filters can be a useful tool or a terrible crutch. Designers should be transparent about their application, because knowledgeable end-users are armed with measurement tools and the internet.

Ivan- I would argue that a "perfect speaker" has a "perfect" phase response, DC to light.

On axis? or everywhere?

JR
 
Re: FIR filters

Isn't the opposite also possible? That the end result is less output?
In the EAW case, my understanding from the link Bennett posted earlier is that the FIR is creating an *echo* signal, that cancels reflections as they come back to the mouth of the horn. Isn't this using more bandwidth and power to get less SPL?

This it not what Bennett is saying.

  1. Any transient involves a wide range of frequency components (lows and highs) that must align with each other in a specific phase relationship to sum together in a way that gives rise to the rapid upward slope when viewing the amplitude versus time (i.e. like how your DAW displays a snare hit during a mix session).
  2. If you scramble the phase relationship between the various frequency components, the energy is still there at each frequency, but the arrivals are no longer coherently combining to give the rapid rise on the amplitude vs. time display. The net result is that the energy content is the same, but the peak amplitude of the signal is reduced.
  3. Since loudspeakers, which by their nature are bandpass devices that exist in a causal (i.e. time goes forward) universe, a loudspeaker is always going to alter the phase relationships of what comes out of it.
  4. We can quantify this alteration, and pre-warp the phase of the original signal to counteract the loudspeaker so that the loudspeaker's inherent limitations serve to re-align the phase back to the original desired signal.
  5. A side effect of the pre-warping on highly organized signals like transients is that the peak amplitude of the signal is usually reduced after pre-warping.
  6. Since amplifiers are usually constrained at high frequencies not by their ability to supply energy, but rather in their maximum voltage swing (i.e. amplitude), reducing the amplitude of the signal peak by pre-warping serves to open up some breathing room on the amplifier voltage swing, and therefore allows more possible peak output from an amplifier with a given voltage swing capability.