78rpm EQ Curve Generator

This plug-in arose from the ‘Adding Features to Audacity’ section of the forum.
For the background, see http://forum.audacityteam.org/viewtopic.php?f=20&t=33824&start=0

The Equaliser effect in the latest Audacity nightly builds http://wiki.audacityteam.org/index.php?title=Nightly_Builds, has a feature which allows EQ curves to be imported or exported as xml files. This raises the possibility that the EQ curves for playback of 78rpm records could be made available as presets in the Equaliser. However the number of EQ curves which exist for 78’s (each record label had its own EQ curve) made inputting them a huge task, so I decided to see if it could be automated; hence the plug-in.
This wiki page http://wiki.audacityteam.org/wiki/78rpm_playback_curves gives a long list of 78 EQ curves.

The EQ Curve Generator creates the EQ curve from the given parameters, and writes it to a file in a format that can be read by Audacity’s Equalisation effect.

How it Works

All 78rpm EQ curves are defined by two parameters; a Bass Turnover Frequency and a 10kHz Rolloff value. These two parameters define a bass boost curve with a ‘corner frequency’ or 3dB frequency at the Bass Turnover point, and a treble cut curve which reduces the gain above a certain frequency, so that the gain at 10kHz is at the required value.
(Note that some 78 EQ curves have a 10kHz Rolloff of zero, i.e. they are flat at treble frequencies)


The principal inputs to the plug-in are the Bass Turnover and 10kHz Rolloff parameters and, from them, the bass boost and treble cut filter curves are calculated and summed. Inevitably, the curves overlap to some extent, which gives incorrect results at the two defined points, so a second pass re-calculates the curves to take account of the interaction between them, and produces the combined curve.

Now, the 78rpm EQ curves, according to their definition, have a bass response which increases without any limit as the frequency gets lower, so that sub-sonic frequencies, turntable rumble etc. would be greatly amplified. To avoid this, I have introduced a Bass Shelving component to the curve. This flattens the curve below a selected frequency. The default setting is 50Hz, but it can be changed as required. I should point out that the only basis I have for this addition is common sense and a gut feeling (plus the fact that it is explicitly included as a component in the RIAA curve which replaced the multiplicity of EQ curves in the 1950’s), so if anyone can point me to some factual information on this element, I would be grateful.

As an option, I have included the ability to normalise the curve to 0dB at 1kHz.

Once the curve is calculated the values are displayed on screen, and written to an xml file called 78EQCurves.xml in a directory chosen in the initial input window (default is /Program Files/Audacity). The name to be given to the curve is also typed in the input window, and is included in the xml file. (Note that, as the plug-in is currently written, each time it is run, the 78EQCurves.xml file gets over-written with the new curve data.)

Once the xml file has been written, the data can be imported from it into the Equaliser effect, and saved as a preset using the ‘Save/Manage Curves’ feature.

The plug-in also has a Help screen, which outlines the background and operation.
When installed, it appears as ‘78rpm EQ Curve’ in the ‘Generate’ menu.

Comments or suggestions for improvement are welcome.

PO’L
78EQCurveGen.ny.zip (3.01 KB)

Hi Irish

Thanks for this. Just some off the cuff comments.

Path should start with C:/ or it will never be written on WIndows, so for example “C:/Program Files/Audacity/”. “/Program Files/Audacity/” will do nothing except write to the current directory. Since this is a type 3 plug-in and C:/Program Files/Audacity/ is default for 1.2 where the plug-in won’t work, perhaps best to just have the path as “C:/”?

I think it would be far more useful if a new write could insert into the xml file, not overwrite. I’d envisage people could enter a few curves at a time, then want to insert the curve once into their presets.

The correct name for our EQ effect is “Equalization” not “Equaliser” so that ought to be corrected in ;info line and Help.

Help will I expect overflow with OK button off-screen at 800x600 on Linux, and in any case lacks any help about whether user should normalise at 1 kHz. Add that to help and split Help file into two pages? Should 1 kHz normalise be on by default rather than off?

Similarly the confirmation of the curve with list of frequencies and gains will be off-screen on smaller screens. I assume a four-column list can’t be written that you would read to the bottom in the first pair of columns, then up to the top on the second pair?

Hobbyhorse: I know it seems fashionable to run the value and unit together in GUIs (“0dB” instead of "0 dB) but I don’t like it as it’s hard to read and technical literature doesn’t do this (nor does your result list) :smiley:


Gale

better to prompt for where to put it
not everybody keeps everything on c:
or has a floppy disk at a:
(which happened to my photos on disk back when when the kodak idiots set it up so you could only see the pix from the a: drive with no option to change it and no way to copy them without using their braindead reader that was hardwired to a:)

andor
suggest you navigate to the audacity location in use
in case folks have more than one version

close enough for govt work
every label did its own thing for sure back on 78s
so what you have should be good enough
unless somebody with a 78 can track down the eq actually used for a particular record

i think that may be generally true , but suspect riaa did it that way as a convenient compromise not something that was absolute.

besides, if they dont like the result they can re-eq to suit their ears

The point is that if the path says C:/, the file will at least be written to the path indicated in the result, and it gives people the correct syntax that they can append to. If the path does not exist, the file will be written to the current folder even though the result indicates it has been written to the specified path.

The suggestion I made for the same problem in Sample Printer was that the text for the control said “Unique, pre-existing output pathn(writes to current folder if empty/invalid)”.


Gale

I just wrote a long reply to Gale’s comments and hit the ‘Preview’ button, only to find that I had been logged out (by the forum software?) and my post had evaporated into thin air.
It’s too late to start again now; I’ll try again tomorrow.

PO’L

Sorry about that. If this happens, hitting back button without logging back in should probably allow you to capture the text that you had, assuming a decent modern browser.


Gale

My workaround for this when writing a long post is to select the whole message from time to time and hit the Ctrl+C button to put it on my paste buffer (that is when I remember - I still get caught out form time to time :slight_smile: ).

In fact sometimes I will write a long response in Word and then paste that into the reply pane! :unamused:

WC

Just in case anyone was waiting for the updates to the plug-in (!), the reason nothing has happened is that, first my IP address was blocked by Spamhaus, and then I went on holidays - this is coming from an internet cafe in northern Italy.

I’ll be back in late August.

PO’L

Here is the updated version of the EQ curve generator.

It includes some new features, in addition to fixing the problems in the earlier version.

I’ve set the default to C:/, as suggested, though it seems like a “least worst” solution.

I don’t know if that is possible. The Nyquist manual states that when a file is opened for output, its current contents are discarded. In any case, if you could append data as default, you would have to purge the xml file at intervals, to avoid having multiple copies of curves imported into Equaliser.

I’ve re-formatted the Help screens, and the output is now in two columns (though a bit clunky, since there doesn’t seem to be an easy way to output a floating-point number in fixed-format with anything other than six decimal places). I think it should now be OK on 800 x 600.

Normalising to 0 dB at 1 kHz is now on by default, and I have included a feature to generate the EQ curve combined with the inverse RIAA curve, for users whose turntable pre-amp can’t be set to “flat”.

PO’L
78EQCurveGen.zip (4.74 KB)

It’s not pretty, and I’m not sure that it’s a good idea, but I think it can be done. You can probably do it by reading the existing file, then appending the new data before writing it back to the file.

Have you tried (for example)

(setq *float-format* "%#1.3f")

or

(setq *float-format* "%g")

See here for details: XLISP *float-format*

Thanks for the tips, Steve.
Setting the format to “%#1.nf” does the job. %g is not so good with columns, as it gives the shortest output, which could be anything from 1 to 6 decimal places.

I had read the page in your link, but it didn’t give the syntax for setting the number of decimal places, so I hadn’t pursued it, except to change from the default %g to %f.

PO’L

Please see further comments in the Submit your EQ curves thread.



Gale

Following discussion in the Submit Your EQ Curves thread, the latest version (2.1) of the 78EQCurveGen plug-in is available here.

This version has the extra functions of the previous version removed, as they were considered superfluous, and also corrects some errors in the code of the previous versions.

POL

78rpm EQ curve generator is now at v4. See https://forum.audacityteam.org/t/submit-your-eq-curves/14671/92



Gale

Update:

The latest version of the EQ Curve Generator plug-in is now V2.5, available here. See this topic for the details.

POL

Update:

The EQ Curve Generator plug-in is now at V2.7, and can be downloaded here.

See this topic for the details.

POL

I’ve not forgotten this Irish, just been a bit busy.

I’ve not found any bugs in it, but as it is rather a complex plug-in there’s a lot to check.
I’d like to get this plug-in up on the wiki where it will hopefully reach a larger audience so the more testing that can happen now the better.

I’ve also had a few ideas for streamlining the code - I doubt that they’ll make any appreciable difference to the efficiency of the code, but they may help to make it easier to maintain if any updates are required at a later date. Details to follow.

Regarding the actual curves - I don’t know the formula for calculating the gain but I assume that you do. What is that, 6dB per octave?

No apology necessary - look at the dates of my two previous posts!

Yes, it is 6dB per octave.

The equation for a generic EQ curve is
EQ curve equation.jpg
where
N is the gain in dB
f is the frequency at which the gain is being calculated
t1 is the time constant of the treble cut curve
t2 is the time constant of the bass boost curve
t3 is the time constant of the LF shelving curve.

In each case t = 1/(2pif) where f is the “turnover” or 3dB frequency for that curve.

The turnover frequencies for the bass boost and LF shelving curves are obtained direct from the plug-in inputs, but the turnover frequency for the treble cut curve has to be calculated from the 10kHz gain rolloff parameter. This calculation is in line 250 of the plug-in, and the gain calculations for the three component curves are in lines 258 to 260.

POL

Terrific, that’s what I was looking for, but now I’m a bit unclear about how that fits with the (gaincalc freq) function:

(defun gaincalc (freq)
   (setq togainlf (* 10.0 (logten (+ 1.0 (/ (expt tofreq 2.0) (expt freq 2.0)))))) 
   (setq togainhf (* (- 10.0) (logten (+ 1.0 (/ (expt freq 2.0) (expt hfto 2.0))))))
   (setq togainshelf (* (- 10.0) (logten (+ 1.0 (/ (expt lfshelf 2.0) (expt freq 2.0))))))
   (+ togainlf togainhf togainshelf))

Oh… no it’s OK, just found this: http://www.platenspeler.com/background/riaa/uk_riaa_background_1.html
The formula in your code is the same as Formula 1.1.b after substituting t1, t2 and t3.
I can see that I’ll be pinking your brains in the future :wink:

I think I’d be tempted to use a macro or function to simplify these equations. Just defining “squared” would help:
(it’s a backquote at the beginning of the second line)

(defmacro sqrd (num)
  `(* ,num ,num))

then you can use:

(defun gaincalc (freq)
  (+
    (*  10.0 (logten (+ 1.0 (/ (sqrd tofreq) (sqrd freq)))))
    (* -10.0 (logten (+ 1.0 (/ (sqrd freq) (sqrd hfto)))))
    (* -10.0 (logten (+ 1.0 (/ (sqrd lfshelf) (sqrd freq)))))))

which is a bit easier on the eye and the brain cells :wink: