Apologies in advance. I’m a newbie to Nyquist.
I have a problem with creating a nyquist plug-in.
This code works:
(hzosc modf *sine-table* 270)
But changing ‘lp’ in the second line to ‘lowpass8’ (or any other lowpass order) the code returns no audio.
What am I doing wrong?
The lp function can accept a flonum (floating point number) or a sound as the cutoff parameter.
lowpass2, lowpass8, etc can only accept a number.
by the way, for Lisp code it is usual to put all trailing “)” on the same line, like this:
(hzosc modf *sine-table* 270)))))))
Also. where possible, I prefer to split long rambling lines like that into a series of lines so that it is easier to read and see what is going on. For example:
(let* ((raised-env (sum 1 (hzosc modf *sine-table* 270))) ;filter envelope
(scaled-env (sum f (mult depth raised-env))))
(normalize (lp s (control scaled-env))))
OK. Got it. (as usual, assumed same type and didn’t check!)
Many thanks. Appreciated.
You can of course “cascade” a series of first order lp filters to give an approximation of a higher order filter.
These two snippets will both produce similar results (over most of the audio range), but the first can accept a sound as the filter frequency:
(setq freq 1000)
(lp (lp s freq) freq)
(setq freq 1000)
(lowpass2 s freq)
OK. I’ve cascaded frequency-distributed notches to get comb filters previously, so here’s my current solution, with intermediate variables renamed to suit my conventions, and styled as you suggested:
(let* ((raised-lfomod (sum 1 (hzosc modf *sine-table* 270))) ;raised sine LFO filter modulation
(scaled-lfomod (sum f (mult depth raised-lfomod)))) ;scaled filter modulation
(normalize (lp (lp s (control scaled-lfomod)) (control scaled-lfomod))))
I’ll experiment with adding
Thanks again for the help.