Updating old Nyquist plug-ins

Hi.

Sorry to bother you, but some of my 2014-ish plug-ins no longer work correctly in Audacity 2.4.2 on my macOS Mohave or High Sierra Macs. I have looked in the Audacity doumentation, and on this forum, but I have not found any guide to updating old Nyquist to the current form. Is there any guide to this process?

Thanks

Martin

If the plug-ins came from the Audacity wiki (Missing features - Audacity Support) then there may be a newer version there already - in which case you can just replace the old version “.ny” file with the new “.ny” file.

If the plug-ins came from the Audacity wiki and the version that is currently there does not work, please let us know exactly which plug-ins they are and I will update them.

@steve,

Thanks for your rapid reply. The plug-ins are my own code, they don’t come from the wiki. So I’m looking for a ‘Coder’s Guide to updating old Nyquist to the current form’.

Thanks,

Martin

Most of the “Audacity” changes to Nyquist plug-ins are covered here: https://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference

In Audacity 2.4.2, the Nyquist library was updated. This has introduced some subtle differences that I’m still figuring out. Many of the changes relate to increased error checks.

One that I’ve encountered a few times is that holding on to samples in RAM is now limited to about 1 GB. If this limit is exceeded then it will throw an error (in the Debug window):

The maximum number of sample blocks has been
reached, so audio computation must be terminated.
Probably, your program should not be retaining
so many samples in memory. You can get and set
the maximum using SND-SET-MAX-AUDIO-MEM.
error: audio memory exhausted

In most cases, the best way to fix this is to change the code so that the plug-in does not hold onto the samples. If that is too difficult, then you could simply add an error check in the plug-in to display a meaningful error if the selection is too long.
Example:

;; Temporarily set SND-SET-MAX-AUDIO-MEM to an
;; arbitrary value so that we can get its current value.
;; 32-bit samples have 4 bytes per sample.

(defun max-samples (&aux (old (SND-SET-MAX-AUDIO-MEM 10000)))
  (SND-SET-MAX-AUDIO-MEM old) (/ old 4))

;; Uncomment to test
;(print (max-samples))

(if (> len (max-samples))
    "Error message"
    (<run-program>))

(where () calls your main code)

@Steve,

Thanks for this, and again, thanks for prompt reply. Good information. Much appreciated.

Thanks,

Martin

I’ve updated the code example at the end of my previous post.
Note that the assumption in that example is that the program only holds samples from one audio channel in memory. If the program holds samples from both channels of a stereo track, then it will be necessary to divide (max-samples) by two.

If you find that a plug-in fails on selections greater than about 45 mins stereo (90 mins mono), then the problem is likely to be due to the code hanging onto samples.

How do I report typos in the Nyquist documentation?

location:
In https://wiki.audacityteam.org/wiki/Nyquist_Plug-in_Headers on line -11, it says:
A single line of text to be displayed at the top border of the plug-in window. For multiple lines of text, a two-character sequence “\n” bay be used within “text” to create a line break.

When it should say:
A single line of text to be displayed at the top border of the plug-in window. For multiple lines of text, a two-character sequence “\n” bay be used within “text” to create a line break.

Action:
‘bay’ should be changed to ‘may’.

Regards,

Martin

Thanks for the report Martin :slight_smile:

I’ve fixed it,

Peter.