1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00
audacity/plug-ins/SpectralEditParametricEQ.ny
2014-10-27 19:07:50 +00:00

32 lines
1006 B
Common Lisp

;nyquist plug-in
;version 3
;type process
;name "Spectral edit parametric EQ..."
;action "Calculating..."
;control control-gain "Gain (dB)" real "" 0 -24 24
(defun wet (sig gain)
(cond
((not (or *f0* *f1*)) (throw 'debug-message "Please select frequencies"))
((not *f0*) (throw 'debug-message "Bottom frequency is undefined"))
((not *f1*) (throw 'debug-message "Top frequency is undefined"))
(t (let*
((fc (sqrt (* *f0* *f1*)))
(width-octaves (/ (s-log (/ *f1* *f0*)) (s-log 2.0))))
(eq-band sig fc gain (/ width-octaves 2))))))
(defun result (sig)
(let*
((tn (truncate len))
(rate (snd-srate sig))
(transition (truncate (* 0.01 rate)))
(t1 (min transition (/ tn 2)))
(t2 (max (- tn transition) (/ tn 2)))
(breakpoints (list t1 1.0 t2 1.0 tn))
(env (snd-pwl 0.0 rate breakpoints)))
(sum (prod env (wet sig control-gain)) (prod (diff 1.0 env) sig))))
(catch 'debug-message
(multichan-expand #'result s))