Find attached the plugin. I expect I’m doing something incredibly stupid (its a speciality). I’m also not precious about doing this as a plugin - if there is a better way to achieve the same outcome, I’m more than happy to be told about it.
If you open Audacity’s log window (“Help menu > Diagnostics > Show log”) you will see that your plug-in returns an error in the final line:
15:42:13: Context was passed in, but was ignored. ApplyAndSendResponse has its own one
15:42:13: Context was passed in, but was ignored. ApplyAndSendResponse has its own one
15:42:13: Context was passed in, but was ignored. ApplyAndSendResponse has its own one
15:42:13: Context was passed in, but was ignored. ApplyAndSendResponse has its own one
15:42:13: Context was passed in, but was ignored. ApplyAndSendResponse has its own one
15:42:13: Nyquist returned nyx_error:
The “nyx_error” is because the plug-in returned NIL, which is treated as an error.
To avoid the error, you need to return a valid value, but since you don’t actually want to return any audio from Nyquist, or text, or lists, or numbers, or anything else, you will need to return a valid “no-op” (https://en.wikipedia.org/wiki/NOP_(code))
In Audacity, when an empty string is returned by Nyquist, Audacity treats it as a no-op.
Here’s a version of your code which I think will work as you intended:
(I also changed the “$” comments to normal “;” comments. The “$” syntax is to allow Audacity to find localized translations for the controls in plug-ins that are shipped with Audacity. It is not possible for Audacity to find translations for 3rd party plug-ins, so best to use the normal “;” syntax).