[Audacity-nyquist] ...another one: db-maximizer plugin
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
|
From: <edg...@we...> - 2005-04-18 01:46:32
|
;nyquist plug-in
;version 1
;type process
;name "dB Max..."
;action " dB Max..."
;info ""
;control vt "Treble" int "(dB)" 0 -12 12
;control vb "Bass" int "(dB)" 0 -12 12
;control vl "Volume" real "(dB)" 6 0 12
; The db-maximizer is a waveshaper. It is mainly intended for broadcast maste-
; ring situations where it is desired to make the sound "as loud as possible"
; without causing overdrive distortion. It also includes a simple equalizer
; with automatic volume compensation so you can do broadcast mastering and
; equalizing in one step including automatic overdrive protection.
; Just simply adjust the sliders and push the button.
;
; How does the maximizer work :
;
; The limiter is a 20 bit sampler. The input signal gets clipped at 20 diffe-
; rent levels with logarithmic (dB) distance and mixed up linearly at the same
; time. Because all samples are generated by clipping low volumes (below vl)
; will get amplified up to 20 times more than loud volumes at the track limit.
;
; You can see it best if you generate a sinus track (Audacity: Generate > Tone)
; then zoom into the track until you can see the sine waves and apply the
; effect with the volume slider at maximum (12) a few times in a row. The sine
; waves get rounded until they become half-circles.
;
; Very nice side-effect: it' absolutely impossible to overdrive the track.
; Nevertheless be careful: the distortion still can become intorerable.
;
; Because the effect is a waveshaper it doesn't change the transients of the
; audio signal like a compressor.
;
; Implementation details:
;
; The equalizer treble and bass slider values are those of standard consumer
; hifi equipment.
;
; The limiter: Because Nyquist internally calculates with numbers greater 1.0
; it is necessary to introduce an 21st clipping as an artificial track limit:
;
; 0.0465 calculates 1/(1+2+3+4...+21) minus a little bit for 0.5 dB headroom
;
; As you have noticed in the highly professional "minus a little bit" wording
; most of the values are based on experience from soldering hardware limiters
; so the exact mathematical formulae still have to be explored - because:
;
; In Nyquist there exists a "shape" function exactly for this purpose. If we
; can find a waveshaper function and bring the "shape" function to work in
; audacity (no comment) I think we can speed up the whole thing a lot.
;
; Meanwhile, here's a example how this could work :
;
(defun Equalizer ()
(setf s (sim
(scale (dB-to-linear vt) (hp s 2000)) ; the treble slider
(lp (hp s 500) 2000) ; the "middle" channel
(scale (dB-to-linear vb) (lp s 500))))) ; the bass slider
(defun Limiter ()
(let ((result 0))
(dotimes (i 21)
(setf result (sum result
(scale (* 0.0465 (dB-to-linear (* vl (/ i 20.0))))
(clip s (dB-to-linear (* vl (/ i 20.0) -1)))))))
result))
; Automatic equalizer volume compensation:
;
; The related functions use statistic values. This works usually fine but
; sometimes (especially Techno-CD's) this can cause unexpected volume changes.
;
; If you want to have manual volume control disable the lines under "automatic
; volume compensation" by adding a comment-sign (semicolon) at the beginning,
; then remove the semicolon in the "(if"-line under "manual volume control"
; and finally in the ";control vl "Volume" real "(dB)" 6 0 12" line (up at the
; top) exchange the middle "0" by "-12".
;
(setf kk 0)
; ------------ automatic equalizer volume compensation ---------------
; Treble greater 0 :
(if (> vt 0) (setf kk (* vt -0.5)))
; Bass greater 0 and greater (Treble / 2) :
(if (and (> vb 0) (> vb (/ vt 2)))
(setf kk (* (+ (* vt 0.05) (* vb 0.8)) -1.0)))
; Bass greater 0 but smaller or equal (Treble / 2) :
(if (and (> vb 0) (<= vb (/ vt 2)))
(setf kk (* (+ (* vt 0.5) (* vb 0.1)) -1.0)))
; ---------------------- manual volume control ------------------------
; (if (vl < 0) (setf kk vl))
; ------------------ the volume compensation routine ------------------
(if (< kk 0) (setf s (scale (dBmax kk) s)))
; --------------------------- the program -----------------------------
(if (or (/= vt 0) (/= vb 0)) (Equalizer)) ; if bass or treble /= 0
(if (or (> vl 0) (> vt 0) (> vb 0)) (Limiter) ; if bass, treble or Volume > 0
(if (or (/= vt 0) (/= vb 0)) s)) ; if bass or treble /= 0 but
; volume = 0 return s
; I think the handling of the return values is no good programming style. If
; anybody knows this better than me please give a message to the audacity
; nyquist list.
;
; This plugin is released under terms of the GPL.
;
; It was written by Edgar M. Franke (Germany) from January to April 2005.
;
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
|