[Audacity-nyquist] Correction for code I just posted...
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
|
From: David R. S. <dav...@sh...> - 2005-11-28 18:58:00
|
Hi Edgar,
I made some math errors, corrections below. David
;; (PEAK sound-expression number-of-samples) - find peak amplitude
;
; NOTE: this used to be called s-max
;
(defmacro peak (expression maxlen)
`(snd-max ',expression ,maxlen))
(defmacro inv-peak (expression maxlen)
`(snd-min ',expression ,maxlen))
(defun bias-adjust (expression)
(setf high (peak expression ny:all)) ; maximum signal height
(setf low (inv-peak expression ny:all)) ; minimum signal height
(setf center (* 0.5 (+ high low))) ; midpoint of signal
(setf adjust (- center)) ; dc bias to add to or subtract from
; expression, so expression goes from -value to +value
(sum expression adjust))
(bias-adjust s)
|