34 lines
1.1 KiB
Common Lisp
34 lines
1.1 KiB
Common Lisp
;nyquist plug-in
|
|
;version 4
|
|
;type process
|
|
;preview linear
|
|
;name "Filter Sweep..."
|
|
;action "Filtering..."
|
|
;author "dm"
|
|
|
|
;control type "Filter Type" choice "Low-Pass,High-Pass,Band-Pass" 0
|
|
;control start-freq "Start Frequency (Hz)" float-text "" 7000 0 20000
|
|
;control end-freq "End Frequency (Hz)" float-text "" 1000 0 20000
|
|
;control shape-num "Curve Parameter" float-text "" 5 nil nil
|
|
;control intensity "Intensity" int-text "" 1 1 50
|
|
|
|
(defun curve (inif finf crv)
|
|
(if (zerop crv)
|
|
(pwlv inif 1 finf)
|
|
(let* ((crv (expt 0.5 crv))
|
|
(norm (/ (- inif finf) (- 1.0 crv)))
|
|
(arc (scale norm (diff (pwev 1 1 crv) crv))))
|
|
(sim finf arc))))
|
|
|
|
(defun iter-lp (signal cutoff iter)
|
|
(dotimes (n iter signal) (setf signal (lp signal cutoff))))
|
|
|
|
(defun iter-hp (signal cutoff iter)
|
|
(dotimes (n iter signal) (setf signal (hp signal cutoff))))
|
|
|
|
(let* ((cutoff (curve start-freq end-freq shape-num))
|
|
(bandwidth (/ *sound-srate* (float intensity) 5.0)))
|
|
(case type
|
|
(0 (iter-lp *TRACK* cutoff intensity))
|
|
(1 (iter-hp *TRACK* cutoff intensity))
|
|
(2 (reson *TRACK* cutoff bandwidth 1)))) |