[Audacity-nyquist] 40-Channel-Vocoder Plugin
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
|
From: <edg...@we...> - 2005-04-16 02:44:07
|
Maybe not a *really* brand-new idea but always nice to play around. I always wanted to have a vocoder where you can tweak *everything* whatever you like. To keep it understandable here's a version where you can adjust only the most important parameters, a more extensive version is also available. Thanks to Rogers dobleway-rectifier, the local bindings discussion during development of the silence finder plugin and examples in the bandfx tutorial from the Nyquist 2.30 IDE it was possible to squeeze the whole thing into incredible eleven lines of code. If you don't believe have a look at this and try it: ;nyquist plug-in ;version 1 ;type process ;name "Vocoder" ;action "Vocoder" ;info "" ;control amp "Amplify" real "" 15 1 30 ;control dst "Distance" real "" 20 0 50 ;control mst "Channels" int "" 2 1 2 ; A Vocoder - How does it work ? ; ; Note for screen reader users: the next lines are mainly graphical content. ; From line 42 (called Explanation) I will explain the principles in detail. ; ; ------------- ------------- \ ; | Music | | Voice | | ; ------------- ------------- | ; | | | ; ------------- ------------- | ; | Bandpass | | Bandpass | | ; ------------- ------------- | ; | | | ; | ------------- | ; | | Rectifier | | ; | ------------- \ ; | | x 40 ; | ------------- / ; | | Integrator | | ; | ------------- | ; | | | ; ------------------------- | ; | Multiplier | | ; ------------------------- | ; | | ; ------------- | ; | Bandpass | | ; ------------- | ; | | ; V to the Mixer / ; ; Explanation: First the Music and the Voice still separated are filtered by ; a bandpass with identical parameters each. Then only the Voice Signal will ; be rectified and interpolated by an integrator so it can be used as an ; envelope for the music signal. The bandpassed music signal and the envelope ; from the bandpassed voice signal will then be multiplied. Unfortunately the ; multiplication causes not only the desired volume control effect but also ; two sideband signals: music plus voice envelope and music minus voice ; envelope what leads to ugly channel interference distortion effects when ; the signals get mixed at the end. The solution is a third bandpass, again ; with identical parameters to the both above, after the multiplier to keep ; the multiplication result inside the related audio frequency range. ; ; All this will be done not only with one frequency channel but with forty ; frequency channels on forty different frequencies in logarithmic distance ; from 20 Hz to 20 kHz where every frequency channel from the voice signal ; controls the related frequency channel of the music signal so the end ; result will be "talking music". ; ; The overall frequency range of the vocoder is much more than is necessary ; for speech modulation so you can use any audio signals you like. Talking ; music is only an example. ; ; To make the effect work in Audacity you have to create a stereo-track with ; the voice (modulator) Signal on the left channel (the upper part) and the ; music (carrier) Signal on the right channel (the lower part) then apply the ; effect. If you want to modulate stereo tracks you have to split them up, ; join each modulator channel with the related carrier channel, apply the ; effect on each of the new created stereo-tracks, then split them up again ; and re-join them to the original stereo-relationship. This is a little bit ; of fuss but the result really pays off. ; ; The three effect sliders: ; ; Amplify: Because you never can be sure how much the frequency spectra of the ; modulator and carrier signals match, the resulting volume is a little bit ; of luck. To prevent distortion by mixing too low volumes in 16-bit formats ; you can amplify each channel *before* they get mixed all by the same amount. ; ; Distance: describes the distance from the center frequency of the channel ; (bandpass2) to the cutoff frequency of the related integrator (lowpass8). If ; the distance is too low you can hear the voice signal "talk through", if the ; distance is too high the consonants and "ssh"-sounds can get faded or lost. ; ; I had the best results with Amplify = 10 to 15 and Distance = 15 to 20. ; ; By the way: "Distance" is not a good term. Non-technical users will not be ; able to understand. If anybody knows something better please change this. ; ; Channels: If you want to modulate mono-speech tracks to stereo-music tracks ; in "one-channel-mode" the speech-channel is left untouched so you can re-use ; it afterwards on the next channel. In "two-channel-mode" both channels are ; changed into two identical mono-tracks so if you work with a headphone you ; can listen to the result without switching the channels. ; ; Also note: For people who need to tweak *everything*: there still exist ; some predecessors of this plugin where you can e.g. interchange the channel ; controls to make modulator channels control non-related carrier frequency ; channels and have access to really *everything* but a warning in advance: ; This vocoder plugin started with more than 800 (eighthundred) lines of code. ; It took me over three months to squeeze it into eleven lines (plus three for ; mono-stereo gimmicks). The direct predecessor e.g. is still 250 lines long. ; ; If somebody is interested please mail to edgar-rft[at]web.de ; ; Implementation details: ; ; (setf p (+ p 3)) ; make quarter-octave steps ; (setf f (step-to-hz p)) ; calculate the related center-frequencies ; ; (setf result (sum result... ; mix everything up ; ; (s-max sound (scale -1 sound)) ; the rectifier (thanks to Roger) ; ; (lowpass8 (rectifier) (/ f dst)) ; the integrator with variable distance ; ; If you have a Nyquist IDE you can print the center frequencies: ; ; (setf p 14) ; (dotimes (i 40) ; (setf p (+ p 3)) ; (print (step-to-hz p))) ; ; This vocoder plugin is released under terms of the GNU Public License. ; ; It was written by Edgar M. Franke (Germany) from January to April 2005. ; (defun vocoder () (let ((p 14) f (q 5.656) (result 0)) (dotimes (i 40) (setf p (+ p 3)) (setf f (step-to-hz p)) (setf result (sum result (scale amp (bandpass2 (mult (lowpass8 (s-max (bandpass2 (aref s 0) f q) (scale -1 (bandpass2 (aref s 0) f q))) (/ f dst)) (bandpass2 (aref s 1) f q)) f q))))) result)) (if (arrayp s) (cond ((= mst 1) (vector (aref s 0) (setf (aref s 1) (vocoder)))) ((= mst 2) (setf s (vocoder))))) __________________________________________________________ Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min. weltweit telefonieren! http://freephone.web.de/?mc=021201 |