"Wave Stats" plug-in

Share your Audacity/Nyquist plug-ins here, or test drive the latest plug-ins submitted by Audacity users.

After testing a plug-in from this forum, please post feedback for the plug-in author.

Re: "Wave Stats" plug-in

Permanent link to this post Posted by steve » Sat Jan 22, 2011 7:51 pm

Try this:
wave-info.ny
"Wave Info" Analysis plug-in.
(2.14 KiB) Downloaded 232 times

After installing and restarting Audacity it will appear in the "Analyze" menu as "Wave Info..."

You may want to check the accuracy of the results against the "Wave Stats" plug-in.
Data from the "Debug" window can be copied and pasted into other applications.
Read all of the text in the plug-in carefully.
If you have comments/questions please post them here.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Senior Forum Staff
 
Posts: 32935
Joined: Sat Dec 01, 2007 11:43 am

Re: "Wave Stats" plug-in

Permanent link to this post Posted by orcamad » Sun Jan 23, 2011 2:27 pm

Thanks so much Steve it works perfectly!!!
orcamad
 
Posts: 11
Joined: Tue Dec 21, 2010 2:38 pm

Re: "Wave Stats" plug-in

Permanent link to this post Posted by Storer » Mon Jan 24, 2011 9:11 pm

Interesting use of the debug output, Steve. I may borrow that idea for some of the stuff I'm working on.

Dave
Storer
 
Posts: 91
Joined: Wed Mar 04, 2009 8:02 pm

Re: "Wave Stats" plug-in

Permanent link to this post Posted by vpd » Wed Apr 16, 2014 8:20 am

Just sharing my edition of the wave stats plugin that meets my criteria...
Thank you Steve for the original plugin!

Changes in this version:
1) Automatically sets the selection time and truncates it to 20 seconds if it exeeds.
2) A-weighted RMS calculation replaced with linear RMS (percentage).
3) Decimal precision set to 2 places.

File:
stats.ny
(1.88 KiB) Downloaded 1 time
vpd
 
Posts: 22
Joined: Tue Feb 26, 2013 4:28 pm

Re: "Wave Stats" plug-in

Permanent link to this post Posted by steve » Wed Apr 16, 2014 3:23 pm

Thanks vpd. Nice to see someone modifying the plug-in to suit their needs. That's one of the great things about Nyquist plug-ins :D

Your code works fine.
A couple of notes from a programming perspective that may be useful for you (or disregard if not ;))

Code: Select all
(setq selected (/ len *sound-srate*))
(setq time (min 20 (max 0 selected))) ; 0 < time < 20

(setq bignum (truncate (* time *sound-srate*)))
(setq step (truncate (min bignum LEN))) ; 'peak' requires blocksize and stepsize as integers

As there is no duration control in this version, this code can be simplified:
Code: Select all
(setq time 20)
(setq bignum (truncate (* time *sound-srate*)))
(setq step (truncate (min LEN bignum)))

In fact it could be simplified into one line, but as we need "bignum" and "time" later on for the messages they may as well all be set here.


Code: Select all
(defun s-rms (s-in)
   (linear-to-dB (sqrt (peak (snd-avg (mult s-in s-in) step step OP-AVERAGE) bignum))))

(defun x-rms (s-in)
  (* (sqrt (peak (snd-avg (mult s-in s-in) step step OP-AVERAGE) bignum)) 100))

We don't really need to calculate the rms level twice (although it really makes very little difference in this case because we are only processing a few seconds of audio).
We could just calculate the rms once as a linear value:

Code: Select all
(defun s-rms (s-in)
   (sqrt (peak (snd-avg (mult s-in s-in) step step OP-AVERAGE) bignum)))

(setq rms-lin (s-rms s-in))

Then convert to dB or % as required.
Code: Select all
(print (linear-to-db rms-lin))
(print (* rms-lin 100))
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
steve
Senior Forum Staff
 
Posts: 32935
Joined: Sat Dec 01, 2007 11:43 am

Previous

Return to New Plug-Ins



Who is online

Users browsing this forum: No registered users and 1 guest