EQmatch with Nyquist

Hi Steve,

Many moons ago, you wrote a proof of concept script that takes the spectrum plot and via a plugin, it can be loaded into the EQ.
Original thread here:

Tried your plugin recently but there seems to be a problem.
(BTW I increased the limit in your script to 200000 with no ill effects on Nyquist, just takes about 30 seconds to complete.
This then allows me to use a greater resolution of 4096 points on the spectrum.)

The problem as follows:

The resulting EQ is always worse (especially at the high end), i.e. since there is no reference, plus the fact (I suspect) that the spectrum uses max at 0dB whilst the EQ is plus or minus relative to 0dB.

It would be great to get something like this going for Audacity, however my Nyquist/Lisp knowledge is nearly zero.
What would be involved to modify the script as follows:

  1. Get reference from music we want to copy the response from.
  2. Get plot of music we want to apply it to.
  3. Script computes if gain or attenuation is required and how much per frequency or from averaged 1/3 octave bins.
  4. Writes out the xml file.

Any help/pointers greatly appreciated.

I guess that you must be using an older version of Audacity. As of version 2.3.3 the Equalization effect has been replaced with “Filter Curve EQ” (https://manual.audacityteam.org/man/filter_curve.html)

In the Audacity 2.3.3 version of Filter Curve, there is no direct support for importing filter curves. The Audacity 2.4.0 version (due to be released this month) is able to import curves, but the format is different from the old Equalization effect.

The new format for filter curves is a simple text file rather than XML. Here’s an example:

FilterCurve:f0="95.922748" f1="101.08667" f2="9989.5734" f3="9989.5734" FilterLength="8191" InterpolateLin="0" InterpolationMethod="B-spline" v0="-120" v1="-0.53097343" v2="-0.067111969" v3="-117.65102"

Breaking this down:

FilterCurve: // The name of the effect

f0="95.922748" f1="101.08667" f2="9989.5734"... // The frequency values of each point

FilterLength="8191" InterpolateLin="0" InterpolationMethod="B-spline"  // Standard filter parameter. Should not normally be changed

v0="-120" v1="-0.53097343" v2="-0.067111969"... // The dB values for each point

The good part of this is that we can now use a Macro command to apply the filter and pass the curve parameters in the command.
Unfortunately we are not able to obtain the spectrum data from macro commands, but it would be possible to do the analysis in Nyquist. FFT analysis in Nyquist isn’t easy, but it is possible.

The disadvantage of using a large “Size” in the spectrum plot is that it can produce too much detail in the high frequencies. For musical purposes we only want the general shape of the EQ, not individual notes. FFT analysis provides equally spaced frequency bins across the entire audio spectrum, so we end up with just a few bins per octave at low frequencies, and possibly hundreds of bins per octave at high frequencies. It would be better if we used a fairly high FFT size so that we can get a reasonable number of bins per octave at low frequencies, but filter the data at high frequencies (smooth the curve) so that we have the same number of data points per octave across the entire frequency spectrum (say 3 bands per octave).

The way that I’d see a future version of Eq Match, is for it to be a Macro. The Macro would first run a Nyquist plug-in on the first track to analyze the spectrum and process it to produce a 3 band per octave output. The second command applies the same Nyquist plug-in to analyze the second (target) track. The third command runs a Nyquist Macro that reads the two data files, generates the “corrective” settings for the Filter Curve (or Graphic EQ effect), and applies the filter to the target track.

This will of course only be possible after Audacity 2.4.0 is released.

Thank you very much for your detailed reply, much appreciated.

You are quite right about the large size in the fft plots and having many more points as frequency increases.
Since my original post, I came up with a way (read kludge) using an OpenOffice spreadsheet and a text editor, much faster than the original Nyquist script.

(BTW I’m using Audacity 2.3.1 on MacOS so the old way of txt export from spectrum and xml import on EQ, still applies).

What I do is:

  • Bring the audio I want to “borrow” the EQ from into Audacity.
  • Then the one I want to apply it to.
  • Normalize both tracks to -12dB.
  • Do a spectrum plot on both (4096 points) and save them as txt files.
  • Bring in the txt files into the spreadsheet where it compares the values and automatically computes a net gain or loss for each frequency.
  • The column of the frequencies and the computed difference I export as a csv file.
  • Then open the csv file in a text editor (Sublime Text) and “massage” the format into xml and save that.

It is now ready to be imported into the EQ plugin and applied to the track.

I know it sounds long winded (did say it was a kludge), but it’s actually very quick and serves my purposes.
It also negates the need for me to go anywhere near Lisp. :smiley:

As a test, used a song and applied some filters to it to make it “brighter” in the high end and some low end gain to make the bass “punchier”.
Then used that new version as the reference.
Bought in the original song (pre-EQ) again and used that one as the test for the EQ match experiment.

The results were pretty darn good, a very close match.

Once version 2.4 of Audacity is out, will take a look and perhaps refine the workflow.
For now, I’m happy.


I know this is an old thread, but I basically whipped up a program to do exactly that. (The EQ matching, that is. )

I’ll record each mic on a different channel/track, then open each track in the plot spectrum analyzer, and export the .txt file.

My program takes the exported TXT files from the two different tracks, calculates the difference, and generates a TXT file to be imported into the EQ Curve effect, where it can then be saved as a preset.

The reason I came across this thread is that that my program works great in Audacity, but I’ve been looking for ways to use it in other DAWs as well, and I’ll be honest?
Audacity’s Filter Curve is FAR superior - it blows everyone else’s away. There’s one or two decent ones out there, but they’re not anything as nice or as versatile as Audacity’s for large quantities of points, and their preset/import/export files are all but inscrutable. (If I NEVER have to deal with iEEE-754, mantissas, checksums or hex conversion again, it’ll be too soon!)

My stuff’s writeen in VFP and it’s a little… kludgy-looking at the moment, but it can currently generate a REALLY nice curve for Audacity and a half-a$$#d not-that-great one for ReaFir.
Ping me if either of you would like to take a look, and I’ll upload a compiled version somewhere.

Speaking of which - is Filter Curve LADSPA, or Nyquist? I’ve been meaning to get on Github and take a look, but I’ve been insanely swamped lately.


Neither. It’s a native effect built into Audacity (written in C++).
The “Filter Curve Eq” and “Graphic Eq” share the same code: https://github.com/audacity/audacity/blob/master/src/effects/Equalization.cpp

Awesome!! That’ll actually make playing with it easy!

Thank you so much.

(Also, mildly unrelated, I got that little program I was talking about earlier to work with Moss EQ too. I STILL like Audacity’s best. But it’s nice to have a couple VST options if I’m switching back and forth between Audacity and something else.)