Coding a Nyquist plugin that simply just brings up the debug output and outputs only a set piece of text to it?

I’m trying to implement the “Hello world/Text” task on Rosetta Code (http://rosettacode.org) as a Nyquist (yes, Nyquist, the programming language, is on Rosetta Code) plugin for Audacity. That implementation would work by simply just bringing up the debug output and output only a set piece of text to it.

Some background about Nyquist:

Nyquist supports two languages: XLISP and SAL.
In the Nyquist manual, you will see that function definitions and some of the examples are given in both XLISP and SAL syntax.

XLISP is a member of the LISP family of languages, and is written with fully parenthesized s-expressions. The syntax for calling a function is:

(func-name args)

where “arg” is a list of 0 or more arguments.

SAL provides a more C-like syntax for Nyquist.

Nyquist is an interpreted language, which is very convenient for scripting. The interpreter compiles the code at run time and returns either the result of the code execution or an error. Running the code may also have side effects in addition to the return value.

Nyquist SAL is based on Rick Taube’s SAL language, which is part of Common Music. When a SAL program runs, the code is translated to XLISP then runs as above. See also: https://www.cs.cmu.edu/~rbd/doc/nyquist/part7.html


Nyquist is available as either a stand alone language (see: https://www.cs.cmu.edu/~music/nyquist/) or as a library. To date, Audacity is the only known implementation of the Nyquist library. The Nyquist library implements most (but not all) functions in the standalone version.
Nyquist in Audacity has been extended with the addition of specially formed “header” comments (see: https://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference#header) and a number of global variables and property lists (see: https://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference#globals and https://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference#property_lists).

In recent versions of Audacity, Nyquist has been extended further with about 50 new functions for sending “Scripting” commands to Audacity via Audacity’s API (see: https://manual.audacityteam.org/man/scripting.html and https://wiki.audacityteam.org/wiki/Nyquist_Macro_Tutorial)

XLISP syntax:

(print "Hello World!")

SAL syntax:

print "Hello World!"

From the Nyquist manual (https://www.cs.cmu.edu/~rbd/doc/nyquist/part7.html#index189):

; this is a comment
; comments are ignored by the compiler
print "Hello World" ; this is a SAL statement

To run “Hello World” in the Nyquist Prompt:

XLISP Syntax:

;type tool

(print "Hello World!")

SAL Syntax:

;codetype SAL
;type tool

return "Hello World!"

To bring up the debug output automatically after running a script, add the header:

For XLISP code:

;debugflags trace

For SAL code:

;codetype SAL
;debugflags nocompiler
;debugflags trace

Examples to run in the Nyquist Prompt:

XLISP:

;type tool
;debugflags trace

(print "This will print to the debug output")
(format t "and so will this.")

"Hello World" ;Return a string literal

SAL:

;type tool
;codetype SAL
;debugflags nocompiler
;debugflags trace

print "This will print to the debug output"
exec format(t, "and so will this")

return "Hello World!"

See also: https://wiki.audacityteam.org/wiki/Nyquist_Plug-in_Headers#debugflags

None of those commands send text to the debug output and output only a set piece of text to them. Instead they just output text to a text window, like http://rosettacode.org/wiki/Hello_world/Graphical#Nyquist does.

Perhaps you need to read all of my reply posts and not just the first one.

Sure enough, looking at your reply posts helped me. Here’s the code of my Nyquist plugin that simply just brings up the debug output and outputs only a set piece of text to it:
;nyquist plug-in
;version 1
;type analyze
;name “Goodbye, World!”
;debugflags trace
print “Hello world!”
return “”

Here’s the code, as you should see it if you were to see it on the Rosetta Code website as a Hello world/Text example (in the previous version of this code I sent you, the title assigned in the code to the plugin was incorrect):
;nyquist plug-in
;version 1
;type analyze
;name “Hello world!”
;debugflags trace
print “Hello world!”
return “”

This is not necessary for a minimal “Hello World!” example.
If you want to include the version number for completeness, new code should use the latest version, which at time of writing in version 4.


This is wrong. It is not an analyze type plug-in, because it is not analyzing audio.
This header should either not be included at all, or should be a “tool” type.
(“tool” type should not be used for “version” less than 4 because it is incompatible.)


This is not necessary for a minimal “Hello World!” example.


When using SAL syntax, the code-type should be defined.

It is more usual to use LISP syntax for Nyquist in Audacity. For standalone Nyquist, SAL syntax is recommended these days.

Note that none of the headers are valid for standalone Nyquist.