;nyquist plug-in
;version 3
;type process
;categories "http://lv2plug.in/ns/lv2core#HighpassPlugin"
;name "HL-Filter..."
;action "Applying Filter..."
;info "by Steve Daulton. Released under GPL v2.\n\nHigh-pass filters attenuate frequencies below the specified frequency.\nLow-pass filters attenuate frequencies above the specified frequency.\nHigher roll-off values give a sharper attenuation of the cut frequencies.\nFilter frequencies must be less than 1/2 of the track sample rate.\n"
;; hl-filter.ny by Steve Daulton, June 2011.
;; Released under terms of the GNU General Public License version 2:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html .
;; Minimum Audacity version 1.3.8
;control type "Filter type" choice "High-pass,Low-pass" 0
;control rolloff "Roll-off" choice " 6 dB per octave,12 dB per octave,24 dB per octave,36 dB per octave,48 dB per octave" 0
;control freq1 "Filter frequency (Hz)" real "" 1000 1 20000
(defun err (Hz)
(format nil "Error.~%The track sample rate is ~a Hz.~%The filter frequency must be less than 1/2 the sample rate.~%The filter frequency (~a Hz) is too high.~%" *sound-srate* (truncate Hz)))
(defun highpass (s-in Hz ro)
(if (>= Hz (/ *sound-srate* 2.0))
(err Hz)
(case ro
(0 (hp s-in Hz))
(1 (highpass2 s-in Hz))
(2 (highpass4 s-in Hz))
(3 (highpass6 s-in Hz))
(4 (highpass8 s-in Hz)))))
(defun lowpass (s-in Hz ro)
(if (>= Hz (/ *sound-srate* 2.0))
(err Hz)
(case ro
(0 (lp s-in Hz))
(1 (lowpass2 s-in Hz))
(2 (lowpass4 s-in Hz))
(3 (lowpass6 s-in Hz))
(4 (lowpass8 s-in Hz)))))
(case type
(0 (highpass s freq1 rolloff))
(1 (lowpass s freq1 rolloff)))