/usr/share/audacity/plug-ins/vocoder.ny is in audacity-data 2.1.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | ;nyquist plug-in
;version 3
;type process
;preview enabled
;categories "http://lv2plug.in/ns/lv2core#SpectralPlugin"
;name "Vocoder..."
;action "Processing Vocoder..."
;author "Edgar-RFT"
;copyright "Released under terms of the GNU General Public License version 2"
;; vocoder.ny by Edgar-RFT
;; a bit of code added by David R. Sky
;; GUI update by Steve Daulton July 2012.
;; Performance improvement, error message for mono, code cleanup
;; by Paul Licameli and Steve Daulton October 2014
;; Released under terms of the GNU General Public License version 2:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
;;
;; For information about writing and modifying Nyquist plug-ins:
;; http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference
;control dst "Distance: (1 to 120, default = 20)" real "" 20 1 120
;control mst "Output choice" choice "both channels, right only" 0
;control bands "Number of vocoder bands" int "" 40 10 240
;control track-vl "Amplitude of original audio (percent)" real "" 100 0 100
;control noise-vl "Amplitude of white noise (percent)" real "" 0 0 100
;control radar-vl "Amplitude of Radar Needles (percent)" real "" 0 0 100
;control radar-f "Frequency of Radar Needles (Hz)" real "" 30 1 100
; maybe the code once again has to be changed into _one_ local let-binding
; if you have lots of nyquist "[gc:" messages try this:
; (expand 100) ; gives Xlisp more memory but I have noticed no speed difference
;; number of octaves between 20hz and 20khz
(setf octaves (/ (log 1000.0) (log 2.0)))
;; convert octaves to number of steps (semitones)
(setf steps (* octaves 12.0))
;; interval - number of steps per vocoder band
(setf interval (/ steps bands))
;;; Some useful calculations but not used in this plugin
;; half tone distance in linear
; (print (exp (/ (log 2.0) 12)))
;; octave distance in linear
; (print (exp (/ (log 1000.0) 40)))
;;; The Radar Wavetable
;; make *radar-table* a global variable.
(setf contol-dummy *control-srate*) ; save old *control-srate*
(set-control-srate *sound-srate*)
(setf *radar-table* (pwl (/ 1.0 *control-srate*) 1.0 ; 1.0 after 1 sample
(/ 2.0 *control-srate*) 0.0 ; 0.0 after 2 samples
(/ 1.0 radar-f))) ; stay 0.0 until end of the period
(set-control-srate contol-dummy) ; restore *control-srate*
;; make *radar-table* become a nyquist wavetable of frequency radar-f
(setf *radar-table* (list *radar-table* (hz-to-step radar-f) T))
;; increase the volume of the audacity track in the middle of the slider
;; the sqrt trick is something like an artifical db scaling
(setf track-vol (sqrt (/ track-vl 100.0)))
;; decrease the volume of the white noise in the middle of the slider
;; the expt trick is an inverse db scaling
(setf noise-vol (expt (/ noise-vl 100.0) 2.0))
;; also increase the volume of the needles in the middle of the slider
(setf radar-vol (sqrt (/ radar-vl 100.0)))
;;; here you can switch the tracks on and off for bug tracking
; (setf radar-vol 0)
; (setf noise-vol 0)
; (setf track-vol 0)
;;; The Mixer
;; calculate duration of audacity selection
(setf duration (/ len *sound-srate*))
(defun mix ()
;; if track volume slider is less than 100 percent decrease track volume
(if (< track-vl 100)
(setf s
(vector (aref s 0) (scale track-vol (aref s 1)))))
;; if radar volume slider is more than 0 percent add some radar needles
(if (> radar-vl 0)
(setf s
(vector (aref s 0)
(sim (aref s 1)
(scale radar-vol (osc (hz-to-step radar-f)
duration *radar-table*))))))
;; if noise volume slider is more than 0 percent add some white noise
(if (> noise-vl 0)
(setf s
(vector (aref s 0)
(sim (aref s 1) (scale noise-vol (noise duration)))))))
;;; The Vocoder
(defun vocoder ()
(do* ((i 0 (1+ i))
mod-envelope ; local variable for filtered envelope of left channel.
band ; local variable for band-passed audio.
(result 0) ; result must be initialized because you cannot sum to NIL.
(q (/ (sqrt 2.0) (/ octaves bands))) ; quick approximation of q
; for given bandwidth.
(p (+ (hz-to-step 20) (/ interval 2.0)) ; midi step of 20 Hz + offset.
(+ p interval))
(f (step-to-hz p) (step-to-hz p)))
((= i bands) result) ; DO for each band then return 'result'.
(setf band (bandpass2 s f q)) ; intermediate results (2 channels)
(setf mod-envelope (lowpass8 (s-abs (aref band 0)) (/ f dst)))
(setf result
(sum result
(bandpass2
(mult mod-envelope (aref band 1))
f q)))))
;;; The Program
(cond
((arrayp s)
(mix) ; changes s
(let ((original (or (= mst 0) (aref s 0))))
(setf s (vocoder))
;; Now normalize s to 0 db peak
(setf s (scale (/ (peak s ny:all)) s))
(case mst
(0 s) ; let Audacity coerce back to stereo
(1 (vector original s)))))
(t ; this effect isn't meant for mono
"Error.\nStereo track required."))
|