Nyquist has a pair of first order Butterworth filters (high pass and low pass) that support a variable frequency corner.
If you require a higher order filter, then the easiest way is to cascade these first order filters.
The code is in the form:
(hp <sound> <frequency>)
or
(lp <sound> <frequency>)
for high pass / low pass, respectively.
is the audio that will be processed.
may be either a number (for a fixed frequency), or a control signal (for a variable frequency).
To generate a frequency value that increases or decreases logarithmically, you can create a “piece-wise exponential envelope” with the command PWEV. For example, to rise from 100, to 2000 over the course of the selection, the PWEV command would be:
(pwev 100 1 2000)
So to create a first order low pass Butterworth filter that has a corner frequency starting at 100 and rising exponentially to 2000 Hz, and apply that filter to the selected audio, the code would be:
;version 4
(lp *track* (pwev 100 1 2000))
This code may be run in the Nyquist Prompt, or adapted to create a plug-in.