Nyquist Apropos Plug-in

From Audacity Wiki
Jump to: navigation, search

Nyquist Apropos Plug-in

Because not all functions, documented in the Nyquist manual, are implemented in Audacity and also not even all Nyquist functions are documented in the Nyquist manual [Lisp is a "programmable programming language", only functions which are considered as stable are documented], it is often helpful to have a tool to find out whether a particular Nyquist function is implemented or not.

Basically only Nyquist functions beginning with "snd-..." are implemented in C within the Nyquist interpreter [in the Nyquist manual they are called 'low-level' functions], while all other Nyquist functions are implemented in the Lisp files within the Audacity "nyquist" sub-directory and can be changed, improved and extended with no need to re-compile Audacity [as long as no C-implemented Nyquist "low-level" function is needed which is not included with Nyquist in Audacity].

All Nyquist/XLISP symbols [e.g. all variable and function names] are stored in the XLISP *obarray*. To find out from within Audacity, whether a particular function is implemented or not, you can e.g. first create and select a "dummy" audio track with any generator from the Audacity Generate menu, then open Effect > Nyquist Prompt... [doesn't work without a selected audio track] and copy the following line into the "Nyquist Prompt" text input field:

 (print (fboundp 'snd-abs))

Important: now please click "Debug" instead of the "OK" button.

First a dialog appears telling you: "Nyquist did not return audio" [or similar]. In this dialog, click the "OK" button. Then another dialog "Nyquist output" appears with the result of the "print" function:

  • T - meaning "true", function is implemented
  • NIL - meaning "false", function is not implemented

I had typed this so often in the past that I have written an Audacity Nyquist "Apropos" Plug-in:

Download: Apropos-Plug-in

Right-Click on the plug-in link, choose "save target as", and save the file "apropos.ny" file in the Audacity "Plug-Ins" sub-directory. After a re-start of Audacity you can find the "Apropos" Plug-in in the Generate menu, the only menu that works without a "dummy" audio track.

The "Apropos" Plug-in offers a pattern search through the Nyquist/XLISP *obarray*. You can also choose between "Functions only", "Variables only" and "All symbols":


Note: with no search pattern [empty field], the plug-in matches all symbol names.

Important: As written in the plug-in window, please press "Debug" instead of the "OK" button, otherwise you will not see the results.

First appears a dialog that reminds me that I have forgotten to press the "Debug" button:


In the first dialog above, just klick the "OK" button. Afterwards, but only if you have clicked the "Debug" button in the plug-in window, appears the window with the results, sorted in alphabetical order: