Let’s rewrite that so that it is easier to see what the code is doing:
(let ((mysound (get-lfo f phase factor center)))
(setf mysound (lp s mysound))
First line: create a local variable (called “mysound”) and let it have the value of the sound generated by “get-lfo”. Note that “get-lfo” returns a low frequency, low sample rate signal (a sound).
Second line: Filter the sound “S” with the frequency determined by “mysound”.
Note in the manual:
lp(sound, cutoff) [SAL]
(lp sound cutoff) [LISP]
Filters sound using a first-order Butterworth low-pass filter. > Cutoff may be a float or a signal (for time-varying filtering) > and expresses hertz. Filter coefficients (requiring trig functions) are recomputed at the sample rate of cutoff. The resulting sample rate, start time, etc. are taken from sound.
whereas, for “lowpass2”:
lowpass2(signal, hz [, q]) [SAL]
(lowpass2 signal hz [q]) [LISP]
A fixed-parameter, second-order lowpass filter based on snd-biquad. > The cutoff frequency is given by hz (a FLONUM) > and an optional Q factor is given by q (a FLONUM).
“lp” can take a number or a signal (a sound) as the frequency parameter, but “lowpass2” requires a (floating point) numeric value for the frequency parameter.
And the error message:
error: In LOWPASS2, 2nd argument (hz) must be > a positive number > or array of positive numbers, got a > SOUND
Re. “or array of positive numbers”:
It looks like the lowpass2 filter has been updated since that part of the manual was written. In current versions of Nyquist, an array of numbers may be used, producing a separate channel for each numeric frequency in the array.
Example (using Audacity’s version 4 syntax):
If you have a stereo track, and you want to filter the left and right channels at different frequencies, you can do this:
(setf left-hz 100)
(setf right-hz 4000)
(setf cut-off (vector left-hz right-hz))
(lowpass2 *track* cut-off)
or, more concisely:
(lowpass2 *track* #(100 4000))