Prompt Basics
This page explains how to use the Audacity Nyquist Prompt to test-run Nyquist code snippets.
Last updated
Was this helpful?
This page explains how to use the Audacity Nyquist Prompt to test-run Nyquist code snippets.
Last updated
Was this helpful?
The Audacity Nyquist prompt appears in Audacity's "Tools" menu.
Sound files are imported into Audacity via: File > Import > Audio or the shortcut CTRL + SHIFT + I
.
If you have no pre-existing sound files to work with, you can create your own mono or stereo tracks via the Audacity "Generate" menu.
Select the track(s) and click Tools > Nyquist Prompt.
The Nyquist Prompt appears like this:
Simply enter the code below and press Apply to receive a "hello world" prompt:
The programming language used above is Lisp. The Nyquist prompt automatically assumes you're using Lisp if the first character is an (
. If it isn't, the prompt assumes you are writing SAL, which is more similar to C-like syntax. If you prefer SAL, a "hello world" program looks like this:
The prompt also comes with a debug button. It shows you various warnings and non-fatal errors after the program finished. For example, if you forget the quotation marks around "
hello world
"
, just hitting apply will just do nothing, whereas hitting debug will tell you where you went wrong:
Audacity uses the *TRACK* variable to reference the current audio file/selection. Thus, you can use basic commands such as mult or sum with *track* and the Nyquist prompt will replace the file/selection with the result (or as Audacity calls it, "returned audio").
Type the following into the Nyquist Prompt (using LISP syntax): (sum *track* 1)
``Or type the following equivalent SAL command: return *track* + 1
The whole signal has now moved up to above zero.
To multiply a signal with a generated carrier signal, you can use the following commands:
The (hzosc 19000) produces 19kHz sine wave carrier.
The (osc-pulse 19000 0)
produces 19kHz square wave carrier (note the 0 is the bias or 50/50 duty cycle, -1 to 1 = 0%-100% pulse-width ). Applying the 19kHz square wave carrier obtains this result.
The top and bottoms of the signal can then be clipped using the Hard Limiter option from the effects menu (0dB limit and Wet level 1) if required.
The above examples show how you can use the many Nyquist commands to perform basic signal processing without using scripts.
The current Nyquist manual is here: .
A useful index of Nyquist commands is here:
Note: These examples are focused upon using Audacity to manipulate digital signals (clearly Audacity is better suited to audio, but features such as Nyquist can open many other uses). For those interested, the signal used is an from a remote control.