mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 16:43:33 +02:00
Paul Licameli's Spectral Editing Patch.
This relies on three new nyquist scripts to actually do the editing. The peak-snapping code in FrequencyWindow has been extracted into a new class, SpectrumAnalyst, to provide peak-snapping in spectrogram too.
This commit is contained in:
33
plug-ins/SpectralEditMulti.ny
Normal file
33
plug-ins/SpectralEditMulti.ny
Normal file
@@ -0,0 +1,33 @@
|
||||
;nyquist plug-in
|
||||
;version 3
|
||||
;type process
|
||||
;name "Spectral edit multi tool"
|
||||
;action "Calculating..."
|
||||
|
||||
(defun wet (sig)
|
||||
(cond
|
||||
((not (or *f0* *f1*)) (throw 'error-message "Please select frequencies"))
|
||||
((not *f0*) (highpass2 sig *f1*))
|
||||
((not *f1*) (lowpass2 sig *f0*))
|
||||
(t (if (= *f0* *f1*)
|
||||
(throw 'error-message "Band width is undefined")
|
||||
(let*
|
||||
((fc (sqrt (* *f0* *f1*)))
|
||||
(width (abs (- *f1* *f0*)))
|
||||
(q (/ fc width)))
|
||||
(notch2 sig fc q))))))
|
||||
|
||||
(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)) (prod (diff 1.0 env) sig))))
|
||||
|
||||
(catch 'error-message
|
||||
(multichan-expand #'result s))
|
||||
|
32
plug-ins/SpectralEditParametricEQ.ny
Normal file
32
plug-ins/SpectralEditParametricEQ.ny
Normal file
@@ -0,0 +1,32 @@
|
||||
;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))
|
36
plug-ins/SpectralEditShelves.ny
Normal file
36
plug-ins/SpectralEditShelves.ny
Normal file
@@ -0,0 +1,36 @@
|
||||
;nyquist plug-in
|
||||
;version 3
|
||||
;type process
|
||||
;name "Spectral edit shelves"
|
||||
;action "Calculating..."
|
||||
|
||||
;control control-gain "Gain (dB)" real "" 0 -24 24
|
||||
|
||||
(defun mid-shelf (sig lf hf gain)
|
||||
"Combines high shelf and low shelf filters"
|
||||
(let* ((invg (- gain)))
|
||||
(scale (db-to-linear gain)
|
||||
(eq-highshelf (eq-lowshelf sig lf invg)
|
||||
hf invg))))
|
||||
|
||||
(defun wet (sig gain)
|
||||
(cond
|
||||
((not (or *f0* *f1*)) (throw 'debug-message "Please select frequencies"))
|
||||
((not *f0*) (eq-lowshelf sig *f1* gain))
|
||||
((not *f1*) (eq-highshelf sig *f0* gain))
|
||||
(t (mid-shelf sig *f0* *f1* gain))))
|
||||
|
||||
(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))
|
||||
|
Reference in New Issue
Block a user