Unfortunately it always returns an empty audio-track. I tried also the code without " but failed as well. When I include the source code of rhythmtrack.ny in my macro it works as expected. But as soon as I add a further line at the end with an aud-do command the new created audio track is empty again.
Thanks for this quick and clear answer. So, I will insert the Nyquist source code of rhythmtrack.ny in my macro and try to include further code to solve my little project.
Depending on what you are doing, another option might be to use a (normal) macro to tie together your new Nyquist code and other plug-ins.
If you need to pass parameters from the new code to the existing plug-in, you could modify the existing plug-in to read values from SCRATCH (see: https://wiki.audacityteam.org/wiki/Nyquist_*SCRATCH*_Tutorial). For example, if the plug-in has a “value” parameter that is set by a ;control
;control value "Enter a value between 0 and 10" int "" 5 0 10
Then you could modify that to something like:
;control value "Enter a value between 0 and 10" int "" 5 0 10
(if (get '*scratch* 'value)
(setf value (get '*scratch* 'value)))
and in your new Nyquist code you would PUTPROP the required VALUE onto SCRATCH.
Thanks again for this hint, which is a smarter way to move information from one nyquist macro to another as I have done right now. As a newbie to nyquist I did’nt know about that and I will try to use it.
Up to now I create a rythmtrack with 132 beats in my first nyquist-macro and added in the second macro a Label track using regular intervall labels, to get vertical lines on every beat of my instrument records when I move around with my mouse (playing american oldtime music with my banjo). For the second nyquist macro I needed the bpm number selected in my first macro. I calculated bpm in my second macro by using the length of my selected audio clip (that starts at 0) knowing that I had a fixed number of 132 beats given:
That worked well for me, but I was thinking about how to move more information from first to second nyquist macro to split the metronome audio track at several measures (oldtime music consist mostly of an A and B part with 8 measures each and repeated once (plus 4 beat for intro)).
Most likely, adding ‘properties’ to SCRATCH is the way to go.
Note (1) that the value of a property may be almost anything; a number, a string, a list, an array, …
Note (2) that any data added to the scratch property list will remain in memory until Audacity is closed, or until you remove the property. It’s best practice to ensure that plug-ins / macros clean up after themselves, so you should ensure that the plug-in / macro removes the data after it has been used.