-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathhplfo.ny
36 lines (29 loc) · 1.07 KB
/
hplfo.ny
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
;nyquist plug-in
;version 1
;type process
;name "High Pass Filter (LFO)..."
;action "Applying LFO high Pass Filter..."
;info "by David R. Sky\nReleased under terms of GNU Public License"
;control f "LFO frequency" real "Hz" 0.20 0.00 20.00
;control lo-f "Lower cutoff frequency" int "hz" 160 20 20000
;control hi-f "Upper cutoff frequency" int "hz" 2560 20 20000
;control phase "LFO starting phase" int "degrees" 0 -180 180
; LFO High pass filter by David R. Sky
; October 14, 2004
; simplified December 30, 2005
; Released under terms of the GNU Public License
; http://www.opensource.org/licenses/gpl-license.php
(setf factor (abs (- hi-f lo-f)))
(setf center (/ factor 2.0))
(defun get-lfo (f phase factor center)
(sum center (mult factor
; convert LFO sweep: -1 to +1
; to 0 to +1
(sum 0.5 (mult 0.5 (lfo f 1.0 *sine-table* phase))))))
; normalize function
(defun normalize (signal)
(setf x (if (arrayp signal)
(max (peak (aref signal 0) ny:all) (peak (aref signal 1) ny:all))
(peak signal ny:all)))
(scale (/ 0.95 x) signal))
(normalize (hp s (get-lfo f phase factor center)))