Programming Language for Audacity Nyquist Plugins
This article explains the programming language used to create native Nyquist audio processing plugins for Audacity. It covers the underlying dialect, the two available syntax styles—Lisp and SAL—and details how these scripts interact directly with Audacity to perform digital signal processing, generate waveforms, and analyze audio data.
Native Nyquist plugins in Audacity are written in Nyquist, a high-level functional programming language designed specifically for digital sound synthesis and audio analysis. Created by Roger Dannenberg at Carnegie Mellon University, Nyquist is built on top of XLISP, an object-oriented dialect of the Lisp programming language. Audacity includes an embedded Nyquist interpreter, allowing it to execute Nyquist code natively without requiring external compilers or dependencies.
Developers writing Nyquist plugins can choose between two distinct syntax notations depending on their preferences and familiarity with programming paradigms:
- Lisp Syntax: The traditional notation relies on
standard S-expressions and prefix notation. Code is enclosed in
parentheses, with functions preceding their arguments (e.g.,
(mult s 0.5)to reduce an audio signal's amplitude by half). - SAL Syntax: SAL (Simple Algorithmic Language) is an alternate syntax introduced to provide an algebraic, Python- or C-like structure. It eliminates heavy nested parentheses in favor of conventional infix operators and command statements, making audio scripting more accessible to developers unfamiliar with functional Lisp dialects.
Nyquist scripts are saved as plain text files using the
.ny file extension. In addition to audio processing logic,
these files include specific comment-based header directives (such as
;type process or ;control) that instruct
Audacity on how to render graphical user interface controls, including
sliders, text inputs, and choice menus, enabling user interaction within
the digital audio workstation.