Equalisation/Crossover - Best way to fit a curve?

Really? I'm quite skeptical of this "no delay" claim. Please tell me how to implement an FIR filter of say 10k taps without any delay penalty... I would really like to know the secret. For example, partitioned convolution ALMOST has no delay, but will still have some on the order of a few tens of samples IIUC.
Hmm, in my book a few tens of samples is for all purposes, pragmatically no delay...

In practice I've found impulse start works well with only a few samples delay. (for pure minimum phase FIR)
 
I have read the whole thread twice, and I am still trying to sort out if the quest for an automated curve fitting is simply an academic curiosity, or if there is some practical need for it. From my admittedly limited perspective, I do not see a need for it. Of all the speaker design, construction, and test activities which could be automated, driver and system EQ is pretty low on the priority list.

The discussion of the mathematics involved is quite fascinating, however.

j.
 
I have read the whole thread twice, and I am still trying to sort out if the quest for an automated curve fitting is simply an academic curiosity,........<snip>
Wondering the same thing...

From my admittedly limited perspective, I do not see a need for it. Of all the speaker design, construction, and test activities which could be automated, driver and system EQ is pretty low on the priority list.
Oh wow, i respectfully couldn't disagree more.

To me, a great speaker design needs two wings to fly......

First wing is the acoustic design....the chosen drivers mounted in whatever physical structure or structures........box, open baffle, waveguide, horn, etc.

The second wing is the electrical design....the drivers' individual EQ's, the xovers, and their system level integration....

Both are absolutely essential wings that need to work in tandem imo, and automation of the electrical design makes that much easier to achieve.
Such automation is a relatively recent blessing for DIY audio...well, all audio really.....imho.
 
That plain and simple fact leaves me scratching my head why do it any other way?

I can think of a number of reasons to try to identify poles and zeros: curiosity, because you like to make an analogue correction filter, because you want to make a motional feedback system rather than an equalizer, or because you want to make a current output amplifier that automatically equalizes the loudspeaker bass response based on an impedance measurement.
 
  • Like
Reactions: TNT
I can think of a number of reasons to try to identify poles and zeros: curiosity, because you like to make an analogue correction filter, because you want to make a motional feedback system rather than an equalizer, or because you want to make a current output amplifier that automatically equalizes the loudspeaker bass response based on an impedance measurement.
Curiosity i get! 🙂
Your other two examples are territory i have no experience with.

My head scratching comment applies only to generating EQs to match up to a target curves for speakers. Like as mentioned in the OP.
Which still leaves me a scratching ... lol


Hey, Maybe you can help with a piece of my curiosity...

For a current driven design: could an impulse response be taken current vs time, and then have inversion applied for correction, and then be pragmatically implemented with the current amp? Or would/could a normal voltage vs time impulse be better to implement?
Out of my depth here..... thx.
 
I have no experience with any of it except curiosity (#). Some 27 years ago I had the wild idea that one could make a current output amplifier that would determine the pole locations of a loudspeaker from its impedance and automatically equalize it, either to have the exact same small-signal response as under voltage drive or an improved response (sort of automatic Linkwitz transform). I never designed or built it, though.

To get the exact same small-signal response as under voltage drive, you would just need an equalizer with the same response as the admittance of the loudspeaker, so 1/impedance.

For the improved response, you would have to determine the low-frequency poles of the impedance (the ones related to the fundamental resonance and the box resonance, if applicable), to cover them with zeros and to put poles at more desirable locations. Theoretically, a system has only one characteristic polynomial, so the poles of the impedance (current-to-voltage transfer) are also the poles of the current-to-sound-pressure transfer. The zeros of the current-to-sound-pressure transfer cannot be determined like that, but for closed box and bass reflex loudspeakers, they are in or close to the origin.

Any low-frequency non-lumped behaviour, like baffle step issues, would probably mess up the whole idea.

Regarding your question, it would seem logical to measure the response under current drive if you want to correct the response under current drive, but as said I have no experience with it.


(#): Actually, some 22 years ago, I did experiment with a current-driven loudspeaker with motional feedback using a second voice coil, but I just manually fitted a lumped model to the measurements.
 
Last edited:
  • Like
Reactions: TNT
Problems of this type are not always easy to solve, and success may depend on how close to the solution you are starting. For a general EQ curve, it is difficult to know a priori how many EQ sections/stages will be needed ..
Thirty, you need, at most, some 30 biquads for a general EQ. The mathematics behind this is the same as that behind a 1/3 octave graphic equaliser. There's seldom an equaliser / loudspeaker that uses / needs more than 30 bands. However, if you have a number less than this, you simply start by applying some smoothing to the response before you begin and later return to a less smoothened response if there're enough biquads left.

Now, there maybe superlative commercial packages like Dirac that use more number of corrections. However, since their related algorithms are guaranteed to never (ever) reach a pair of hobbyist hands, forums like these can only "talk" about such great methods a lot to provide these products with lots of free advertisement, while discouraging ourselves.

Instead, with just a little effort (and some common sense), one could come up with his own method (and possibly more than one) using IIR filters (PEQ), or use something more free / open, like the Python Room Correction, in case FIR filtering is preferred.
 
... you need an iterative...approach.
...
There is a much simpler way to get a PERFECT match to a desired EQ curve the first time, every time: use ... FIR filter instead of a multiple IIRs!
Ah, this is the key!
If there is an explicit, closed form solution to correct the impulse response in the time domain then that implies there is an equivalent solution in the frequency domain, because time and frequency are connected by a reversible transformation.
So it seems it should be possible to derive the pole/zero fit to a frequency curve without any iterative approximation solver.
It's not so dissimilar to a Fourier analysis (take a time variable function and find its sine and cosine components), instead take a frequency variable function and find its pole and zero components.
If we assume the frequency response is a rational polynomial (common assumption, time delay is often not an issue or else dealt with separately) then the fact it has a essentially unique composition of complex poles and zeros is a consequence of the so called "Fundamental Theorem".
So there is a well defined answer and we should be able to find it directly, without iteration, or at least that was the idea behind my first post.
I have read the whole thread twice...to sort out if the quest...is simply an academic curiosity, or if there is some practical need for it.
Well, first I want to understand. I said above it's like the Fourier transformation, and it resembles it in this respect too:- that maybe you have a particular problem that needs it, but once you understand the concept then it is far more useful than any individual application, it's a powerful mental tool.
The discussion of the mathematics involved...
Hope you liked the post above!

Best wishes
David
 
There is a much simpler way to get a PERFECT match to a desired EQ curve the first time, every time: use a single FIR filter instead of a multiple IIRs!

I think perfect is a slight exaggeration.

You can take the inverse DFT of the reciprocal of the measured frequency response (reciprocal magnitude and inverse phase), probably tapered off at low frequencies because you don't want to excessively boost subsonic signals and maybe with some delay added for causality's sake, but there will always be nonzero deviations from the desired curve at the frequencies in between the ones used for the inverse DFT. They are probably only small for a smooth curve, but can get large for steep filters. That's why steep FIR low-pass filters are often designed with iterative algorithms such as Parks-McClellan (for linear-phase filters) or with windowing.
 
Last edited:
Now, there maybe superlative commercial packages like Dirac that use more number of corrections. However, since their related algorithms are guaranteed to never (ever) reach a pair of hobbyist hands, forums like these can only "talk" about such great methods a lot to provide these products with lots of free advertisement, while discouraging ourselves.
Or just use the free DRC-FIR which although nowhere near as simple to use as Dirac is I think better as it gives you manual control over every setting.
http://drc-fir.sourceforge.net/
 
  • Thank You
Reactions: Dave Zan
I think perfect is a slight exaggeration.

You can take the inverse DFT of the reciprocal of the measured frequency response (reciprocal magnitude and inverse phase), probably tapered off at low frequencies because you don't want to excessively boost subsonic signals and maybe with some delay added for causality's sake, but there will always be nonzero deviations from the desired curve at the frequencies in between the ones used for the inverse DFT. They are probably only small for a smooth curve, but can get large for steep filters. That's why steep FIR low-pass filters are often designed with iterative algorithms such as Parks-McClellan (for linear-phase filters) or with windowing.
The OP refers to "equalizing a speaker" which I take to mean force the response of the loudspeaker and crossover to some target (e.g. flat or whatever you want). This EQ curve is not going to pathological in nature, so I would expect neither steep sections nor the need to EQ down to a very low frequency.

There is an off the shelf product that does exactly what you describe: the Ultimate Equalizer by Bodzio software. You will find extensive documentation and examples if you search for it. It's an FIR approach.
 
If there is an explicit, closed form solution to correct the impulse response in the time domain then that implies there is an equivalent solution in the frequency domain....
Yes, there is.
So it seems it should be possible to derive the pole/zero fit to a frequency curve without any iterative approximation solver....the fact it has a essentially unique composition of complex poles and zeros is a consequence....there is a well defined answer and we should be able to find it directly, without
Theoretically, you could simply equate the response and its reciprocal (separately) to zero and obtain all the zeroes and poles (respectively), but that would again need a numerical solver (there could be many roots). It is worth recollecting at this point that the very idea of "iteration" was itself born from numerical methods like Newton's (is that a clue ??).

It maybe easier to replicate a smoothed version of the given (DUT) response using several PEQs and then use their poles and zeroes (using a simple script like in #20) to do rest of the work. The direct method looks like an attempt to make an equivalent for a PLL, without using a feedback loop.

Or just use the free DRC-FIR...
I read that the source code is not only available but also allowed to be modified. But, why isn't the problem over then?
 
The OP refers to "equalizing a speaker" which I take to mean force the response of the loudspeaker and crossover to some target (e.g. flat or whatever you want). This EQ curve is not going to pathological in nature, so I would expect neither steep sections nor the need to EQ down to a very low frequency.

I agree completely, but as the OP is interested in the mathematics, it makes sense to make a distinction between a perfect solution and a good but imperfect one that approaches a perfect solution as the impulse response length and word lengths approach infinity if the required equalization curve is sufficiently smooth.
 
  • Like
Reactions: Dave Zan
It is when you quote it as incompletely as you did.

What I meant is that when the desired response is smooth, you can approximate it arbitrarily accurately by choosing a long enough filter length and long enough coefficient wordlengths.
OK, I see now. I used the word PERFECT myself and you were (I assume) reacting to that. Poor choice of words on my part.

What I was meaning to say in that earlier post was that, rather than trying to achieve the EQ curve via lots of IIR filters (here I assume that some finite number of them would successfully do that) you can instead use a single FIR filter that contains the complete amplitude and phase response of the EQ curve, and that only some finite number of filter taps would be required to do that to within a very small tolerance.
 
A pre release version of REW has some interesting new features in the trace arithmetic section that make it more suitable to produce practical inversion filters on it's own, including target matching and dip limiting.

https://www.avnirvana.com/threads/v5-20-10-early-access.10787/

Trace arithmetic

Trace arithmetic has a few new features:

  • There is an optional regularisation factor to use during trace arithmetic division or inversion and optional frequency limits can be set to apply to the operation. The regularisation factor avoids problems from very low levels in the divisor, limiting the boost they would otherwise cause.
  • There is a target level to use with the trace arithmetic inversion operation, with an option to set the level automatically based on the average level of the measurement. That adjusts the inverse to present it relative to the desired level. If the target level is not used the levels of the results of 1/A and 1/B trace arithmetic operations are adjusted so that the level of the response being inverted is retained when multiplied by the inverse.
  • An option has been added to exclude parts of the response that look like notches from the trace arithmetic inversion operation.
  • If trace arithmetic is carried out on one measurement with an impulse response and one without the result will have an impulse response. This could be used to apply a target response adjustment to an IR, for example.
  • An A * B conjugate trace arithmetic operation has been added, which corresponds to a cross-correlation.
  • The IR windows for the result of a trace arithmetic division operation are set to cover the full span of the response.
As an example of how some of those features might be used, a measurement could be inverted to a target magnitude response shape by dividing the measurement by the desired target magnitude then 1/A inversion with regularisation and suitable frequency limits on the result could be sued to generate a convolution filter that will invert the original measurement to the desired target shape. The result of the regularised inversion could be exported and used in a convolution engine, such as that offered by Equalizer APO.
 
  • Like
Reactions: kipman725
When we decide to fit a dataset with a line there are well defined algorithms like Least Squares fit in statistics.
All clear cut and reproducible.
Hey David - you sure sent this whole forum down a dead end with that talk about least squares fit.

The core question is what to do after you have a freq response plot in order to get the best sound.

First obstacle is you need to smooth the plot suitably so you are talking about realities not room artefacts.

Then you need a "house curve" because you need a target, eh. The smart money is on getting more watts as the freq goes down and being sure to have lots of low bass.

Next, you have to convert a log picture into a hearing experience, which I think is most telling in narrow plot valleys which don't have much sound impact (rather than the peaks which likely do mess with the sound). So don't pay attention, least squares or otherwise, to the narrow dips.

Fool's errand to fuss with all the bumps since they will change as the move the mic and just in case you are listening with more than one ear. Goal is to have the general contour regular.

All that said, the FR is not your hearing FR. There is no physical representation I know of that reliably resembles your hearing because your hearing system mushes together FR, reverb, and I don't know what else in a manner that isn't just a mic FR. So you need recordings you know well and over years of listening in order to have a benchmark for final ear tuning.

Well, that's the start of the kind of guidance you need and as much as I can think of just this minute.