Add Level Difference to "Measure RMS" Tool

I like the new “Measure RMS” tool. One of the uses of this tool is to show any balance difference when recording stereo, for instance after recording a needledrop. It would be helpful in this case for the tool to display which track is higher RMS and by how much. That way it’s simple to adjust via “Amplify left or right channel” effect. Thanks.

Clipboard01.jpg
Notes:

  1. Although stereo LPs are not necessarily L/R balanced, a fine adjustment like this offers more control than the pots on most ADCs and the visual of the recording meter
  2. The higher level should be measured so the resulting negative amplification does not push the recorded waveform into clipping.

You can easily make this change yourself.

Tools you will need:
A “Plain Text Editor”. For Windows I would recommend NotePad++


Instructions:

Locate the file “rms.ny” in the Audacity plug-ins folder, and open it in NotePad++
Make a backup copy of the original “rms.ny” file and put it somewhere safe in case you mess up.

Scroll down to line 60, where you will find:

(format nil "~a: \t~a ~a~%~
                  ~a: \t~a ~a~%~
                  ~a: \t~a ~a"
                  (_ "Left") (linear-to-db (aref rms 0)) (_ "dB")
                  (_ "Right") (linear-to-db (aref rms 1)) (_ "dB")
                  (_ "Stereo") (linear-to-db (stereo-rms rms)) (_ "dB"))

This code is the printed message. It’s a bit more complicated than a normal print / format message because it supports translatable strings.
A quoted string that is enclosed with "(" and “)” is translated when Audacity’s language is set to a language that has a translation. Thus when Audacity is set to French,
**(
“Left”)** is translated to “Gauche”

“~a” is a special character combination that is replaced by a value when the “format” command is executed. For example, the code:

(format nil "The answer is: ~a" 42)

will print:
“The answer is: 42”

Each “~a” is replaced in order, so the first is replaced by (_ “Left”), the second by (linear-to-db (aref rms 0)) and so on.

The character combination “~%~” means “start a new line and ignore leading spaces on that new line”.


The line that you want to change is the second line:

~a: \t~a ~a~%~

where the first “~a” is replaced by (_ “Right”), the second “~a” replaced by (linear-to-db (aref rms 1)), and the third by (_ “dB”).


To calculate the difference between left and right channels:

(- (linear-to-db (aref rms 0)) (linear-to-db (aref rms 1)))

Putting this all together, the format command needs to be:

(let ((rms (get '*selection* 'rms)))
  (if (arrayp rms)
      (format nil "~a: \t~a ~a~%~
                  ~a: \t~a ~a (~a ~a)~%~
                  ~a: \t~a ~a"
                  (_ "Left") (linear-to-db (aref rms 0)) (_ "dB")
                  (_ "Right") (linear-to-db (aref rms 1)) (_ "dB")
                      (- (linear-to-db (aref rms 0)) (linear-to-db (aref rms 1))) (_ "dB")
                  (_ "Stereo") (linear-to-db (stereo-rms rms)) (_ "dB"))
      (format nil "~a: \t~a ~a" (_ "Mono")(linear-to-db rms)(_ "dB"))))

This works perfectly! (Well, except for my “Note #2” but I can work with that.) Thanks for your reply.