MP3 Export - batch processing

One of the limitations of Audacity Macros for batch processing, is that it is not possible to specify MP3 settings.

Here is a Nyquist plug-in that can be installed in the usual way (https://forum.audacityteam.org/t/installing-nyquist-plug-ins/62381/1) to overcome that limitation.
When installed and enabled, the plug-in will appear as “MP3 Export…” in the “Tools” menu.

The plug-in can then be used in Macros in place of the normal “ExportMP3” command.
The difference between this plug-in and the normal Macro command is that the plug-in allows you to specify the MP3 settings.

Nyquist plug-ins do not have check boxes, so the interface is a bit ugly:

MP3Export.png
When “Project Rate” is set to “Default”, the “Project Rate” will be used as the sample rate for the exported file, if possible. You can override the default sample rate by selecting a different rate in this control.
Note that for very low bit-rate MP3s, (24 kbps or lower), the maximum sample rate is 24000 Hz. The plug-in will automatically reduce the project rate to 24000 if necessary, overriding the selection in this control.


Here’s the plug-in:
MP3Export.ny (3.62 KB)
This plug-in has only been tested on Linux with Audacity 3.0.2, 3.0.4 and 3.1.0 alpha.
If you use this on Windows or macOS, please post to say if it works OK.