Nyquist Basics: Adding a Delay Effect

From Audacity Wiki
Jump to: navigation, search

This page explains how to use Nyquist to add a feedback delay effect in Audacity.
The "Nyquist Basics" tutorials start with very simple examples at the top of each page with increasing complexity towards the end. You do not necessarily need to work through to the end of each page to be able to understand the other tutorials. If you feel confused, try any of the other Nyquist Basics tutorials, in any order. Every "Basics" page contains lots of notes and hints where you can find extra information.
Related article(s):
Please note: Nyquist supports both a LISP syntax and a more conventional syntax called SAL. You can choose a manual from a link above based on which syntax you are using.

Note: All [comments] and [explanations] are written in square brackets, so they cannot be confused with (Lisp code).

Adding a Feedback Delay Effect to an Audacity Track

To add a feedback delay effect to an Audacity track with Nyquist, the easiest way is to use the Nyquist "feedback-delay" function:

  (feedback-delay sound delay feedback)

The "feedback-delay" function applies feedback delay to sound. The delay must be a number (in seconds). The sample rate is the maximum from sound and feedback (if feedback is also a sound). The amount of feedback should be less than 1 to avoid an exponential increase in amplitude. Also since output is truncated at the stop time of sound, you may want to append some silence to sound to give the filter time to decay.

Hint: See The Audacity Nyquist Prompt for an explanation how the Nyquist prompt works.


1. First either load a sound file into Audacity or create an audio track with Generate > Tone in the menu.

2. Now click Effect > Nyquist Prompt. A window with a text field will appear where you can type in:

;;"(sine 440)" generates a sinusoidal sound wave at 440Hz to be used as the feedback 
(feedback-delay *track* 0.7 (sine 440)) 

Important: Do not forget to type the parens. The parens are part of the Lisp language Nyquist is based on. Without the parens the Nyquist Lisp interpreter will not be able to understand your code.

After clicking "OK" in the "Nyquist Prompt" window the "feedback-delay" function will take the Audacity sound and return a output sound with a feedback delay of 0.7s throughout the sound. The result of the last computation of the Nyquist code always gets automatically returned to Audacity.

Note: The *TRACK* variable is the Audacity "sound" [the selected part of the Audacity track]. Nyquist in Audacity always understands *TRACK* as the Audacity sound variable.

Try "feedback-delay" with longer or shorter delay times as well as different sounds for feedback. Nyquist provides many more functions to generate sounds besides the simple "sine" function. Look at Functions: Sound Synthesis for the complete list of these functions.