4
4
;name "High Pass Filter..."
5
5
;action "Performing High Pass Filter..."
6
;control f "Cutoff frequency" real "Hz" 1000 1 rate
6
;info "by Dominic Mazzoni, modified by David R. Sky\nReleased under terms of the GNU General Public License Version 2\nAttenuates frequencies below your specified cutoff frequency.\nHigher rolloff values give a sharper attenuation of frequencies below\nthe cutoff frequency. If using a rolloff of 6 dB, a [q] value greater than\ndefault 0.7 increases resonance ['ringing'] of the cutoff frequency and\ncould result in clipping."
8
;control rolloff-choice " Rolloff [dB per octave]" choice " 3 dB, 6 dB,12 dB,18 dB,24 dB" 0
9
;control q " Filter quality [q] for 6 dB rolloff" real "" 0.7071 .1 20
10
;control f " Cutoff frequency [Hz]" real "" 1000 1 20000
12
; note that all Nyquist highpass functions
13
; [hp, highpass2, highpass4, highpass6, highpass8]
14
; are defined below with -s suffix.
15
; This enables highpass functions other than hp
16
; to deal with stereo selection,
17
; and dummy q arg for all but highpass2
20
(defun hp-s (s f q) ; dummy q arg
24
(defun highpass2-s (s f q)
26
(vector (highpass2 (aref s 0) f q)
27
(highpass2 (aref s 1) f q))
31
(defun highpass4-s (s f q) ; dummy q arg
33
(vector (highpass4 (aref s 0) f)
34
(highpass4 (aref s 1) f))
38
(defun highpass6-s (s f q) ; dummy q arg
40
(vector (highpass6 (aref s 0) f)
41
(highpass6 (aref s 1) f))
45
(defun highpass8-s (s f q) ; dummy q arg
47
(vector (highpass8 (aref s 0) f)
48
(highpass8 (aref s 1) f))
51
; check function: returns 1 on error
52
(defun check (arg min max)
53
(if (and (>= arg min) (<= arg max))
57
; initialize blank error-msg
60
; check for erroneous q value
62
(and (= rolloff-choice 1)
63
(= (check q 0.1 20) 1))
64
(strcat error-msg (format nil
65
"q value ~a lies outside valid range 0.1 to 20
66
for your chosen rolloff of 6 dB per octave.
70
; check for erroneous frequency cutoff value
72
(= (check f 1 20000) 0)
74
(strcat error-msg (format nil
75
"Cutoff frequency ~a Hz lies outside valid range 1 to 20000.
80
((> (length error-msg) 0)
81
(setf error-msg (strcat (format nil
82
"Error - \n\nYou have entered at least one invalid value:
84
(format nil "~a" error-msg))
86
(t ; perform highpass effect
87
(funcall (nth rolloff-choice '(hp-s highpass2-s highpass4-s highpass6-s highpass8-s))
92
; from previous commit
9
93
; arch-tag: 49302eba-9945-43d7-aade-f1c7eded27af