|
;nyquist plug-in |
|
;version 1 |
|
;type analyze |
|
;name "Amplitude statistics..." |
|
;action "Calculate amplitude statistics..." |
|
|
|
; endolith@gmail.com |
|
; 2010-08 |
|
|
|
; Set the output format (example: 53.3 dB) |
|
(setq *float-format* "%#3.2f"); |
|
|
|
(defun rms-flat (a) ; compute the RMS of a sound |
|
(sqrt (snd-fetch (snd-avg (mult a a) (round len) (round len) OP-AVERAGE))) |
|
) |
|
|
|
(defun analyze (s-in) ; code that does the analysis and returns data as a string |
|
|
|
; Measure DC |
|
(setq dc-offset (snd-fetch (snd-avg s-in (round len) (round len) OP-AVERAGE))) |
|
|
|
; Remove DC |
|
(setq s-in (diff s-in dc-offset)) |
|
|
|
; Should peak measurement be before or after removing DC? |
|
; Peak samples should be measured before |
|
|
|
; Calculate the maximum and RMS levels |
|
; RMS of full scale square wave is 0 dBFS |
|
(setq lmax (snd-maxsamp s-in)) |
|
;(setq lmax (linear-to-db (peak s-in ny:all)) |
|
(setq lrms (rms-flat s-in)) |
|
|
|
; A-weighted version of sound - by Edgar (thanks!) |
|
(setq sa (lp (lp (hp (hp (hp (hp s-in 20.6) 20.6) 107.7) 737.9) 12200) 12200) ) |
|
|
|
; Calculate the RMS level of the A-weighted signal |
|
; constant is a fudge factor to normalize to 0 dB at 1 kHz |
|
(setq larms (* 1.3363917 (rms-flat sa))) |
|
|
|
|
|
(format NIL |
|
"DC offset: ~a%~%Peak level: ~a (~a dBFS)~%RMS level: ~a (~a dBFS)~%A-weighted: ~a dBFS(A)" |
|
(* dc-offset 100) lmax (linear-to-db lmax) lrms (linear-to-db lrms) (linear-to-db larms)) |
|
) |
|
|
|
(defun analyze-mono (input) ; for mono tracks |
|
(format NIL "Mono track properties~%~%~a~%" |
|
(analyze input)) |
|
) |
|
|
|
(defun analyze-stereo (input) ; for stereo tracks |
|
(format NIL "Stereo track properties~%~%Left channel:~%~a~%~%Right channel:~%~a~%" |
|
(analyze (aref input 0)) |
|
(analyze (aref input 1))) |
|
) |
|
|
|
(if (arrayp s)(analyze-stereo s)(analyze-mono s)) |
I want to download Wave Stats Plug in as advised by ACX.com as I am a narrator. Unfortunately Adobe won't allow this as it is unsupported and because it was sent by email. Can anyone kindly advise how to get round this, or provide some other way of monitoring RMS levels.
Thanks
Grayspires in the UK