RMS normalize plugin

Hello,

I discovered a bug in this plugin: Example…
I use Audacity a lot for normalizing samples, so the steps are:

  1. Normalize a batch of them
  2. Export multiple

Since some samples don’t sound as long as others, their files are of course shorter than those of bass notes.
The regular “normalize” in Audacity does it properly: some note files are longer/shorter than others.

However, when using the RMS plugin, then exporting multiple, ALL the files come out at the same
length, this length being that of the LONGEST sounding files. Thus, much disk space is wasted, for sample
files that should be (e.g.) 8 seconds in length all turn out to be MUCH longer; the folder shows that each and every file is exactly the same length.

Just thought I’d point this out, to include in your “bug” list.

Happy Holidays to everyone!

  • David Bolton

Hi David. This is due to a limitation in “Nyquist plug-ins” and applies to all Nyquist plug-ins.
Nyquist plug-ins process the entire “selection”, regardless of whether the selection contains audio or not. If the audio track selection includes “empty space”, then Nyquist sees that as “silence” and processes it accordingly. The reason that you are getting tracks padded with silence at the end is because you are using a selection that goes beyond the end of the audio, and then applying a Nyquist plug-in to the selection.

I am about to start writing my own Nyquist macros / plugins.

Just as a matter of interest, is there no way I could instruct my routines to check whether the silence at some point in a selected track is still part of a clip - or merely the absence of one?

For example, is there not some way to get info which lists the start and finish times of each separate clip laid out along a track’s timeline?

Just asking - because that would certainly be one handy piece of info (and it is certainly available to Audacity - or it couldn’t be offered in the bottom message bar).

Yes that’s possible. In fact there are two ways, depending on whether you are writing a “Nyquist Effect” or a “Nyquist Macro”.

There’s an important distinction between “Nyquist Effects” and “Nyquist Macros”. In the former type, it is Nyquist that modifies the project. In the latter, it is Audacity’s “Scripting” commands that modify the project. You should only use one or the other. Attempting to combine the two will lead to unexpected problems.

For Nyquist Effects, so long as there are less than 1000 audio clips in a track, you can get a list of start and end times of each clip with:
(get 'track 'clips)

For Nyquist Macros, you can use:
(aud-get-info “clips”)
https://manual.audacityteam.org/man/nyquist_macros.html#AUD-GET-INFO

Thanks, Steve.

And, just to be clear, then, Nyquist Macros are scriptable, have functions, and allow you to create loops and logical (if/then) branches?

I ask this, because I’ve tried the “Macros…” tool — which allows you visually to enter a batch of practical steps into a single laundry list.
"Tools:Apply Macro" will then apply these, in strict sequence, to a single Audacity selection:
• when Audacity gets to the bottom of that list, it stops;
• you can’t, say, test for the number of tracks and tell it to run the same list n times - track by track;
• you can’t check the name of each track and modify that automatically to name a duplicate track for export.

But do I understand this is not “Nyquist Macros” — nor are the routines of “(aud do… )” statements used by Nyquist Effects plugins?
— That there is actually now a third option, called “Nyquist Macros”?

When I start to wrap my brain around Nyquist Macros, will it be through typing instructions into routines that may include variables, functions, loops, branches and other logical programming features?

If so where would I enter those instructions:
— into the Nyquist prompt?
— into my own .txt file to save and upload?
— some other way?

Sorry that this is digressing a little from the original request.

Yes.

“Nyquist” is a small, but well featured programming language. It has all of the looping / branching / conditional logic features that you would expect from a programming language.

I use the word “Scripting” to refer to Audacity’s “Scripting Commands” (Scripting Reference - Audacity Manual)
“Scripting commands” may be sent to Audacity in one of three ways:

  1. “Macros” (just a list of Scripting commands)
  2. From “Nyquist” (which we call “Nyquist Macros”, to distinguish from “normal” Nyquist programs)
  3. From external programming languages such as “Python” via “mod-script-pipe” (Modules Preferences - Audacity Manual)



Yes, that’s correct.



Exactly so. A “normal” Macro is, as you say, a simple laundry list that runs top to bottom, then stops.


“AUD-DO” is a special Nyquist command, which sends a “Scripting command” to Audacity.

Example:

In a (normal) “Macro”, you might have a Scripting command:

Select:Start="0" End="1"

In Nyquist, we can send that exact same command via AUD-DO:

(aud-do "Select:Start=0 End=1")



The simplest way to run Nyquist (including “Nyquist Macros”) is via the Nyquist Prompt. This is particularly useful when working out (developing) the code, and when working with very simple scripts.

The Nyquist Prompt becomes a bit cumbersome when dealing with more complex Nyquist programs (lots of typing), and it’s not convenient for Nyquist programs that you want to use frequently. This is where “Nyquist Plug-ins” come in.
A “Nyquist Plug-in” is simply a Nyquist program that can be installed into Audacity (like the “High Pass Filter” effect, or any of these Nyquist plug-ins: Missing features - Audacity Support

To create a “Nyquist Plug-in”, you write your Nyquist program as a plain text file, add the required “headers”, and change the file extension from “.txt” to “.ny”.

Example:

A Nyquist script that may be run in the Nyquist Prompt:

(mult 0.5 (noise))

The above code will generate white noise into the selection, and amplify (multiply) it to half height (-6 dB).

A “Nyquist plug-in” that does exactly the same thing:

;nyquist plug-in
;version 4
;type process
;name "Noise Test"

(mult 0.5 (noise))

Note that a “Nyquist Plug-in” can also be run in the Nyquist Prompt, which is very handy for testing purposes.

But what if we want to control the amplitude level? (we may want the noise to be higher or lower than 0.5).
In this case, we can add “widgets” to the Nyquist plug-in:

;nyquist plug-in
;version 4
;type process
;name "Noise Test"

;control amp "Amplitude" float "0 to 1" 0.5 0 1

(mult amp (noise))

Try running the above in the Nyquist Prompt to see how it works.

I have attached what is coming up every time I try to pass the ACX requirements. I’m having a hard time getting the RMS levels correct. It says they are under. How can I bring them up, without bringing everything else out of whack?
audacity.PNG

Normalize the RMS so that it is within the required range (I’d suggest -21 dB).
The peak level will probably then be too high, so use the Limiter effect to bring the peaks down (Limiter - Audacity Manual)
I’d suggest using the default settings except for “Limit to (dB)” which I’d suggest setting a little below -3dB, say -3.2 dB.


The noise floor shown by ACX Check is too low. ACX say there should be consistent “room tone” during gaps. You’ve got deathly silence rather than room tone.

Before you try to automate The Process, you should see if you can get The Process to work manually on your sample.

Screen Shot 2020-02-15 at 4.16.02.png
That’s from here:

https://wiki.audacityteam.org/wiki/Audiobook_Mastering

The posted suite guarantees Peak and RMS. The only variable after that is background noise or Room Tone.

That will just get you past the AC Robot which checks technical specifications similar to ACX Check. You also have to pass Human Quality Control where a real human listens for theater problems such as chapter matching, stuttering and wet mouth noises.

Koz

Thanks once again, Steve, for a full and comprehensive reply above.

Sorry to have been so long getting back to it.

I am still not entirely clear, though about Nyquist, “Nyquist Macros,” and “Scripting Commands.”

I feel I must still be misunderstanding something fundamental here.

What I gather is that Nyquist is not Audacity and Audacity is not Nyquist; the latter has been constructed in order to make use of the former.

Is there, perhaps, some special Nyquist language application — perhaps complete with coding/editing facility — that I could choose to run, separate from Audacity, that would then pipe instructions to Audacity via “Aud-Do”?

If I write code in a plain text file and either copy it into the Nyquist Prompt, or upload it as a plug-in, is that what you’d call a “Nyquist Macro” (as opposed to “pure” Nyquist)?

Am I right that such a “Nyquist Macro” routine or plug-in would not require “Aud-Do” at the beginning of each statement?

Would such a Nyquist Macro routine allow me, for example, to check the name of the selected track, then export the selection as a sound file with the name, say, “trackNameString_1.mp3” ?

If so, how do I come by a detailed description of Nyquist language, commands and functions — with especial reference to those which apply to Audacity?

Forgive me. I know that I am asking this question in the wrong place. I would be very happy to ask it somewhere else if you have a better idea under which category/ies to file it?

Yes that’s correct.


Nyquist is a programming language for audio, and is available separately from Audacity: Nyquist Info
(Nyquist was created by Roger Dannenberg, who is also one of the co-founders of Audacity).
Nyquist was shoehorned into Audacity in a very early Audacity release (I’m unsure which version) and has been included with Audacity ever since.


Some of the points below are quite “technical” and are not really necessary for normal use of Nyquist or Audacity. (You don’t need a mechanic’s understanding of how cars work to drive a car).


Yes. Here: Nyquist Info


I’m not sure if it’s possible to pipe commands from the stand alone version of Nyquist. That’s an academic question, as Nyquist in Audacity does not need to “pipe” commands to Audacity. The version of Nyquist built into Audacity is a “shared library” rather than a stand alone application. As a shared library, it is plugged into Audacity’s data structures.

It is possible to “pipe” commands to Audacity from other languages (such as Python). The language must support a feature called “named pipes” (Named pipe - Wikipedia).



That’s the basic mechanism for passing “Scripting” commands from Nyquist to Audacity.
Nyquist sends “Macro Scripting” commands to Audacity using the Nyquist function “aud-do”.
The “aud-do” command takes one argument (one “parameter”) which is the “Macro Scripting command”.

(aud-do "the-scripting-command-goes-here")

In the next Audacity release, there is an alternative way to pass scripting commands from Nyquist to Audacity, via a bunch of new Nyquist functions. I’m in the process of documenting this now.


If the code uses “Macro Scripting” commands to modify the Audacity project, then we call it a “Nyquist Macro”.
If the code uses only normal Nyquist commands to modify the project, then we call it a “Nyquist Script” (when run in the Nyquist Prompt), or a “Nyquist Plug-in” (when installed as a plug-in).

“Nyquist Macros” are usually “tool” type plug-ins, and appear in Audacity’s “Tools” menu. There are exceptions to this, but it is generally the case.


Yes, that’s possible with a Nyquist Macro.
It is also “possible” with just normal Nyquist, but is somewhat easier with a Nyquist Macro.


There’s quite a lot of information about Nyquist, but not much yet about using Macro Scripting commands with Nyquist (I’m still working on that).
For Nyquist documentation, see the links in this post: Manuals and reference material
Also, the Audacity wiki now has a “Nyquist” category: Missing features - Audacity Support


This forum board is the right place to ask about Nyquist.
For specific questions, it’s best to start a new topic. This also helps others to find answers for questions that have been asked previously.

Thanks once again, Steve, for a full and very helpful reply.

When I next have a moment, I’m going to start working my way through the list of Nyquist commands.

ATB.