Can a generator plugin tell Audacity to generate an empty stereo track?

I wrote a stereo generator which needs to produce a certain phase relationship between channels, so it’s not easy to do by applying a mono generator twice. Unfortunately, Audacity seems geared towards mono generators because when there’s no track selected when you try to run a generator it will insert a mono track automatically. But my generator plug-in being stereo will fail on this auto-generated empty track, because it returns a vector. Of course, there’s the manual workaround to first insert an empty stereo track, make sure it’s selected, then run my generator. But it got pretty annoying, to have to do all this clicking repeatedly, every time I want to run my stereo generator. If I forget a step, like I insert the stereo track, but forget to select it, the generator will still fail etc.

So, is there a way for the generator plugin to declare itself as stereo e.g. in the header, so that Audacity generates an empty stereo track? I could not find option in the headers documentation. I guess it’s an enhancement request.

Also, it seems that macros can only run plugins with fixed settings. So while I can have a macro that will first create an empty stereo track, select it, and then run the stereo generator plugin, I could not find a way to have the generator plugin display its dialog box anymore in that approach. And macros don’t seem to be able to have the nice equivalent of plugin parameter dialog boxes. Never mind that I’d have to duplicate every parameter from the plugin dialog in the macro dialog, even if it could show such dialogs. So, a better integration of macros and plugins seems needed, at least for some workflows. The nuisance with stereo generator plugins can certainly be solved in the simpler way I suggest in the previous paragraph, but it would also be perhaps useful in general for macros to have ask-on-run kind of parameters, for which they could build a dialog box of their own. I mean you can go in and edit the right point in the macro steps before running it, but that is more cumbersome to have to remember which step that is etc. It’s like having to edit hardcoded constant in a program, instead of supplying it with some arguments. So, I guess that’s enhancement suggestion #2, in one post. :stuck_out_tongue:

I assume that is a Nyquist effect?

(If it’s any other type of effect, you can create a Nyquist Macro to add a stereo track and then run the effect, but a Nyquist Macro cannot call a Nyquist effect).


The easiest type of compiled effects to code are LADSPA.
These you can then call from a macro.

LADSPA headers and structure are pretty straight forward, compared to VST or AU
and can be compiled for Windows and Linux.
Although I also use MacOS, never had occasion to run a LADSPA plugin on MacOS, if it’s even possible.
(I’m sure it is).

You could make a small macro to set up the stereo track (and assign a keyboard shortcut)

SelectTime:End="10" RelativeTo="ProjectStart" Start="0"

Then you would just need to press the shortcut key(s) before (manually) applying the effect.

Well, I made this The binaries are ready in the CI queue if you want to (easily) test them.
(I think the Audacity repo disables artifact retention, but I’ve “enabled” it for my fork. We’ll I didn’t have to do anything, as it’s on by default in github. I just had to enable actions for my fork.)


Just wondering why you limited it to two channels. (A use case for supporting more than 2 channels could be splitting a track into multiple frequency bands).

Also, when returning 2 channels when one channel is selected, the returned audio is at the start of the track rather than aligned to the selection. Is that intentional (why?) or do you intend to change that?

Indeed, but there are a lot of hardcoded two-channel arrays in Nyquist.h (just search for “[2]” in the file). And I’m not responsible for those. (Also nyx.c isn’t a lot better in that regard.) It will take a fair bit of work to make it support more.

Also, when returning 2 channels when one channel is selected, the returned audio is at the start of the track rather than aligned to the selection. Is that intentional (why?) or do you intend to change that?

I can add that as a feature later, even during this PR maybe. It did occur to me already one may want that alignment, but it wasn’t immediately obvious to me how to code it so it happens. I’m not using ClearAndPaste like the usual (“overwriting”) fx code path does because I use the “hidden” tracks (outputTracks) that were already being created in Nyquist.cpp, they were just not being added to the TrackList. And those outputTracks are zero aligned. I’m not sure how to time shift them. I might need to create new ones and ClearAndPaste into the latter, since ClearAndPaste does support offsets, but I’m hoping there’s a simpler method.

When recording more than 2 channels, Audacity just adds the number of mono tracks required to accommodate the number of channels: 4 channel recording => 4 mono tracks. Perhaps Nyquist plug-ins should do the same (?)

I agree that support for >2 channels returned from Nyquist (fx/gens) would be desirable. Nyquist itself is less limiting than what Nyquist.cpp and nyx.c impose, i.e. in RBD’s Nyquist one can have vectors of 5 sounds etc. But I think Audacity support for >2 channels returned from Nyquist should be done in a separate GH issue/PR. May I suggest you open an issue on Github for the latter, >2 channel support, if there isn’t one already? (A quick search doesn’t find such a topic.)