mirror of
				https://github.com/cookiengineer/audacity
				synced 2025-10-31 14:13:50 +01:00 
			
		
		
		
	Updated Spectral effects to v4 plugins and added GPL v2 license information (with agreement from Paul Licameli).
This commit is contained in:
		| @@ -1,35 +1,40 @@ | ||||
| ;nyquist plug-in | ||||
| ;version 3 | ||||
| ;version 4 | ||||
| ;type process | ||||
| ;name "Spectral edit multi tool" | ||||
| ;action "Calculating..." | ||||
| ;action "Filtering..." | ||||
| ;author "Paul Licameli" | ||||
| ;copyright "Unknown" | ||||
| ;copyright "Released under terms of the GNU General Public License version 2" | ||||
|  | ||||
|  | ||||
| ;; SpectralEditMulti.ny by Paul Licameli, November 2014. | ||||
| ;; Updated to version 4 by Steve Daulton November 2014. | ||||
| ;; Released under terms of the GNU General Public License version 2: | ||||
| ;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||||
|  | ||||
| (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)))))) | ||||
|   (let ((f0 (get '*selection* 'low-hz)) | ||||
|         (f1 (get '*selection* 'high-hz)) | ||||
|         (fc (get '*selection* 'center-hz))) | ||||
|     (cond | ||||
|       ((not (or f0 f1)) (throw 'error-message "Please select frequencies.")) | ||||
|       ((not f0) (highpass2 sig f1)) | ||||
|       ((not f1) (lowpass2 sig f0)) | ||||
|       ((= f0 f1) (throw 'error-message "Bandwidth is zero.\nSelect a frequency range.")) | ||||
|       (T (let ((q (/ fc (- f1 f0)))) | ||||
|            (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))) | ||||
|   (let* ((tn (truncate len)) | ||||
|         (rate (snd-srate sig)) | ||||
|         (transition (truncate (* 0.01 rate))) ; 10 ms | ||||
|         (t1 (min transition (/ tn 2)))        ; fade in length (samples) | ||||
|         (t2 (max (- tn transition) (/ tn 2))) ; length before fade out (samples) | ||||
|         (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)) | ||||
|  | ||||
| (if (string-not-equal (get '*TRACK* 'VIEW) "spectrogram"  :end1 4 :end2 4) | ||||
|     "Use this effect in the 'Spectrogram'\nor 'Spectrogram (log f)' view." | ||||
|     (catch 'error-message | ||||
|       (multichan-expand #'result *track*))) | ||||
|   | ||||
| @@ -1,33 +1,59 @@ | ||||
| ;nyquist plug-in | ||||
| ;version 3 | ||||
| ;version 4 | ||||
| ;type process | ||||
| ;preview enabled | ||||
| ;name "Spectral edit parametric EQ..." | ||||
| ;action "Calculating..." | ||||
| ;action "Filtering..." | ||||
| ;author "Paul Licameli" | ||||
| ;copyright "Unknown" | ||||
| ;copyright "Released under terms of the GNU General Public License version 2" | ||||
|  | ||||
|  | ||||
| ;; SpectralEditParametricEQ.ny by Paul Licameli, November 2014. | ||||
| ;; Updated to version 4 by Steve Daulton November 2014. | ||||
| ;; Released under terms of the GNU General Public License version 2: | ||||
| ;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||||
|  | ||||
| ;control control-gain "Gain (dB)" real "" 0 -24 24 | ||||
|  | ||||
| (setf control-gain (min 24 (max -24 control-gain))) ; excessive settings may crash | ||||
|  | ||||
| (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)))))) | ||||
|   (let ((f0 (get '*selection* 'low-hz)) | ||||
|         (f1 (get '*selection* 'high-hz)) | ||||
|         (fc (get '*selection* 'center-hz)) | ||||
|         (bw (get '*selection* 'bandwidth))) | ||||
|     (cond | ||||
|      ((not (or f0 f1)) | ||||
|         (throw 'debug-message (format nil "~aPlease select frequencies." p-err))) | ||||
|      ((not f0) | ||||
|         (throw 'debug-message (format nil "~aLow frequency is undefined." p-err))) | ||||
|      ((not f1) | ||||
|         (throw 'debug-message (format nil "~aHigh frequency is undefined." p-err))) | ||||
|      ((= bw 0) | ||||
|         (throw 'debug-message (format nil "~aBandwidth is zero.\nSelect a frequency range." p-err))) | ||||
|      (t (eq-band sig fc gain (/ bw 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))) | ||||
|        (transition (truncate (* 0.01 rate)))  ; 10 ms | ||||
|        (t1 (min transition (/ tn 2)))         ; fade in length (samples) | ||||
|        (t2 (max (- tn transition) (/ tn 2)))  ; length before fade out (samples) | ||||
|        (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)) | ||||
| (cond | ||||
|   ((not (get '*TRACK* 'VIEW)) ; 'View is NIL during Preview | ||||
|       (setf p-err (format nil "This effect requires a frequency selction in the~%~ | ||||
|                               'Spectrogram' or 'Spectrogram (log f)' track view.~%~%")) | ||||
|       (catch 'debug-message | ||||
|         (multichan-expand #'result *track*))) | ||||
|   ((string-not-equal (get '*TRACK* 'VIEW) "spectrogram"  :end1 4 :end2 4) | ||||
|       "Use this effect in the 'Spectrogram'\nor 'Spectrogram (log f)' view.") | ||||
|   (T  (setf p-err "") | ||||
|       (if (= control-gain 0)  ; Allow dry preview | ||||
|           "Gain is zero. Nothing to do." | ||||
|           (catch 'debug-message | ||||
|             (multichan-expand #'result *track*))))) | ||||
|   | ||||
| @@ -1,13 +1,22 @@ | ||||
| ;nyquist plug-in | ||||
| ;version 3 | ||||
| ;version 4 | ||||
| ;type process | ||||
| ;preview enabled | ||||
| ;name "Spectral edit shelves..." | ||||
| ;action "Calculating..." | ||||
| ;action "Filtering..." | ||||
| ;author "Paul Licameli" | ||||
| ;copyright "Unknown" | ||||
| ;copyright "Released under terms of the GNU General Public License version 2" | ||||
|  | ||||
|  | ||||
| ;; SpectralEditShelves.ny by Paul Licameli, November 2014. | ||||
| ;; Updated to version 4 by Steve Daulton November 2014. | ||||
| ;; Released under terms of the GNU General Public License version 2: | ||||
| ;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||||
|  | ||||
| ;control control-gain "Gain (dB)" real "" 0 -24 24 | ||||
|  | ||||
| (setf control-gain (min 24 (max -24 control-gain))) ; excessive settings may crash | ||||
|  | ||||
| (defun mid-shelf (sig lf hf gain) | ||||
|   "Combines high shelf and low shelf filters" | ||||
|   (let* ((invg (- gain))) | ||||
| @@ -16,23 +25,37 @@ | ||||
|                          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)))) | ||||
|   (let ((f0 (get '*selection* 'low-hz)) | ||||
|         (f1 (get '*selection* 'high-hz))) | ||||
|     (cond | ||||
|      ((not (or f0 f1)) | ||||
|         (throw 'debug-message (format nil "~aPlease select frequencies." p-err))) | ||||
|      ((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))) | ||||
|        (transition (truncate (* 0.01 rate)))  ; 10 ms | ||||
|        (t1 (min transition (/ tn 2)))         ; fade in length (samples) | ||||
|        (t2 (max (- tn transition) (/ tn 2)))  ; length before fade out (samples) | ||||
|        (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)) | ||||
| (cond | ||||
|   ((not (get '*TRACK* 'VIEW)) ; 'View is NIL during Preview | ||||
|       (setf p-err (format nil "This effect requires a frequency selction in the~%~ | ||||
|                               'Spectrogram' or 'Spectrogram (log f)' track view.~%~%")) | ||||
|       (catch 'debug-message | ||||
|         (multichan-expand #'result *track*))) | ||||
|   ((string-not-equal (get '*TRACK* 'VIEW) "spectrogram"  :end1 4 :end2 4) | ||||
|       "Use this effect in the 'Spectrogram'\nor 'Spectrogram (log f)' view.") | ||||
|   (T  (setf p-err "") | ||||
|       (if (= control-gain 0)  ; Allow dry preview | ||||
|           "Gain is zero. Nothing to do." | ||||
|           (catch 'debug-message | ||||
|             (multichan-expand #'result *track*))))) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user