26 lines
808 B
Common Lisp
26 lines
808 B
Common Lisp
;nyquist plug-in
|
|
;version 4
|
|
;type generate
|
|
;categories "http://lv2plug.in/ns/lv2core#GeneratorPlugin"
|
|
;preview linear
|
|
;name "Inharmonic..."
|
|
;action "Generating Tone..."
|
|
;author "dm"
|
|
|
|
;control decay "Decay" float "" 0.5 0 1
|
|
;control ratio "Ratio" float "" 1.005 1 1.05
|
|
;control fund-freq "Frequency (Hz)" float "" 420 1 600
|
|
;control duration "Length (Seconds)" float "" 3 0 6
|
|
|
|
(setq loop-number 500)
|
|
|
|
(do* ((cur-ind 1 (incf cur-ind))
|
|
(cur-pch (hz-to-step fund-freq) (hz-to-step (* (/ (+ cur-ind 1) 1.0 cur-ind) ratio (step-to-hz cur-pch))))
|
|
(cur-vol decay (* decay cur-vol))
|
|
(result (scale cur-vol (sine cur-pch duration))
|
|
(sum result (scale cur-vol (sine cur-pch duration)))))
|
|
(
|
|
(or (> cur-pch 120) (>= cur-ind loop-number)) result)
|
|
(print cur-pch)
|
|
(print cur-vol))
|