Scott, the answer sort of turned into a status report, so I thought it 
might be useful to the list as well--I hope you don't mind:

Scott Rossi <[EMAIL PROTECTED]> said, on 7/4/00 12:52 PM:

>I was wondering if your work with AIFF files would allow for something like
>a script-based audio level meter, which could determine (even vaguely)
>levels of audio in a sound file.  Would be neat to build a sort of poor
>man's level meter in MC.  Curious what you've found...

I'm not sure; I've used two methods so far in analyzing the sound. In 
both cases I grab the sound a thousand samples at a time. It's 16 bits, 
22khz, so each batch I grab is about a twentieth of a second. The first 
method was to see how many of the samples differed from a base of -500 by 
more than x, either positive or negative. I experimented with x from 100 
to 300, looking for between 200 and 300 samples that were different by 
more than that to indicate that there was noise (that I wanted). Now I'm 
comparing each sample to the one previous, and summing the total 
differential. If it comes out to more than about 30,000 over 1000 
samples, that's noise (that I want). The second method seems to be much 
clearer: sounds that I want, even when quiet, total to at least 70-80 
thousand, and up to a million when the sound is loud. the background hiss 
of the recording never gets above about 20,000.

That said, I don't know why baseline noise seems to hover around -500; is 
it my recording setup, and it would be different on another computer? 
That's why I switched to the second method, figuring that it was 
baseline-independent. The clearer indication of sound was a byproduct.

I also don't know what values would indicate louder versus softer. I 
_think_ the method I'm using now, differentials, would give a measure of 
that. The only way to find out is to try it.

I'll put up the stack later today so people can try it out. It's very 
rough, though... an interface only a hurried programmer could love. :-)

Okay, it's five minutes later, and the answer is yes, sort of. (Ain't it 
great?) I now have a scrollbar set as a progress bar, and it sets its 
value based on the log of the differential. It seems to work very well, 
and hardly slows down the process at all. The sort of comes from the fact 
that it's showing the differential on the samples as it reads them in, 
which is not the same as the actual sound I'm hearing. I have it going 
through a large sound file, cutting out the useful bits, and saving them 
each to separate files. It plays each one right after it saves it, but 
obviously, the samples it's measuring and displaying can't be the same 
ones that are playing at the moment. Still, it's quite impressive.

Again, I'll post it a little later today, and mail the list when it's up.

Thanks for the feedback!

Geoff

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to