44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
|
;nyquist plug-in
|
||
|
;version 4
|
||
|
;type generate
|
||
|
;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin"
|
||
|
;preview linear
|
||
|
;name "FM Chirp..."
|
||
|
;action "Generating Chirp..."
|
||
|
;author "dm"
|
||
|
;copyright "Released under terms of the GNU General Public License version 2"
|
||
|
|
||
|
;control carri-params "Carrier (Start End Curve)" string "" "800 200 -1.5"
|
||
|
;control modul-params "Modulator (Start End Curve)" string "" "450 -1.0 5.7"
|
||
|
;control modul-scale "Modulation Index" float-text "" 50 0 nil
|
||
|
;control dur "Duration" float "" 1 0.01 5
|
||
|
|
||
|
;;;curve going from inf to finf with curve parameter crv.
|
||
|
(defun piece (inif finf crv)
|
||
|
(if (zerop crv)
|
||
|
(pwlv inif 1 finf)
|
||
|
(let* ((epsilon (expt 0.5 crv))
|
||
|
(norm (/ (- inif finf) (- 1.0 epsilon)))
|
||
|
(arc (scale norm (diff (pwev 1 1 epsilon) epsilon))))
|
||
|
(sum finf arc))))
|
||
|
|
||
|
;;;stole this one from David R. Sky's Sequencer 2.
|
||
|
(defun string-to-list (string)
|
||
|
(read (make-string-input-stream (format nil "(~a)" string))))
|
||
|
|
||
|
(defun list-to-floats (input-list)
|
||
|
(mapcar #'float input-list))
|
||
|
|
||
|
(defun string-to-curve (string)
|
||
|
(apply #'piece (list-to-floats (string-to-list string))))
|
||
|
|
||
|
(defun three-numbersp (input-list)
|
||
|
(eq (mapcar #'numberp input-list) (list (= 0 0) (= 0 0) (= 0 0))))
|
||
|
|
||
|
(stretch-abs dur
|
||
|
(let* ((modul-freq (string-to-curve modul-params))
|
||
|
(carri-freq (string-to-curve carri-params)))
|
||
|
(hzosc
|
||
|
(sum carri-freq
|
||
|
(scale modul-scale
|
||
|
(hzosc modul-freq))))))
|