Nyquist Basics: The Audacity Nyquist Prompt
|With the Audacity Nyquist Prompt you can test small snippets of Nyquist code you are working on, or run a Nyquist effect in any way you wish (as opposed to how that plug-in works as built into Audacity). On this page the basic usage of the Nyquist Prompt is explained.
The Audacity Nyquist prompt appears in Audacity's "Effect" menu. This menu can be only be activated if an Audacity audio track exists and at least some audio in it is selected.
Load a Sound File
If you have a mono or stereo sound file available you can import it into Audacity via:
CTRL + SHIFT + Ior the shortcut
If you have no sound files available you can build your own mono or stereo tracks via the Audacity "Generate" menu.
Create a Mono Track
Click. Leave everything as-is, just click "OK", a mono track will appear in the Audacity window:
Create a Stereo Track
1. Create an empty stereo track.
- In Audacity 1.2.x click .
- In Audacity 1.3.x-beta click .
In both cases an empty stereo track will apperar in the Audacity window.
2. Now click. Leave everything as-is, just click "OK", the empty stereo track will get filled with the generated sound.
The Nyquist Prompt
Click CTRL + A on the keyboard. A window like the following will appear:. If the Effect Menu is greyed out because no part of the audio is selected, press
The Nyquist Interpreter
In the "Nyquist Prompt" window, type into the text field a string "hello" with quotes:
If you click "OK", you should get a window displaying the word hello:
Click "OK" in the "hello" window to make it disappear again.
Congratulations, you just have learned how to send text messages to the user.
The Nyquist Debugger
After clicking "OK" in the "hello" window, clickagain, but this time type the word hello without the quotes:
Important: Now click "Debug" instead of "OK".
You should first get a window displaying a "Nyquist did not return audio" or similar message:
After clicking "OK" in the window above, a second window appears, displaying the detailed Nyquist error messages:
Basic Nyquist Commands
The Nyquist manual relevant to audacity is available here Nyquist Reference Manual.
Audacity uses the 's' variable to reference the current audio file/selection. Thus you can use basic commands such as 'mult' or 'sum' with 's' and the Nyquist prompt will replace the file/selection with the result (or as Audacity calls it 'returned audio').
Applying a DC offset to a signal
Original Signal before command.
Type the following into the Nyquist Prompt:
(sum s 1)
The whole signal has now moved up to above zero.
Modulating with a carrier frequency
To multiply a signal with a generated carrier signal you can use the following commands:
(mult s (hzosc 19000))
The (hzosc 19000) produces 19kHz sine wave carrier.
(mult s (osc-pulse 19000 0))
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 etc.
- Find the zero crossing points
- Then only apply the carrier frequency to those regions above zero.
Thanks to forumn users stevethefiddle & kozikowski for their help with Audacity & Nyquist