Page 2 of 2

Re: Finding average RMS volume

Posted: Sun Oct 31, 2010 3:36 am
by guyburns
Here are some results of my testing file sizes.

File 1 – 52 minutes, 16-bit stereo (~550 MB)
Crashed while trying to calculate wave stats.

File 2 – 28 minutes, 16-bit stereo (~300 MB)
Took about 20 seconds to calculate and present the stats, and about the same time to exit the wave stats window.

I was running a program called Activity Monitor while testing. It shows all sorts of data about CPU and memory. During the calculation of the wave stats for File 2, CPU usage attributed to Audacity sat around 80% with Free Memory (amount of unused physical memory) decreasing from 750 MB to 30 MB during the wave stats calculations, while VM Size (total amount of allocated virtual memory) increased by about 900 MB.

Inactive Memory (total allocated physical memory that is currently unused) was never below 1 GB. It appears that I have plenty of inactive memory being hogged by other programs that is not available to Audacity.

Can I allocate more memory to Audacity like I can for Photoshop?

Re: Finding average RMS volume

Posted: Sun Oct 31, 2010 4:47 am
by kozikowski
The one in Photoshop is the memory map before the program starts swapping off to the hard drives. If you're dealing with modules that don't swap -- ever -- and it's entirely possible you are, then you will always run out.

And no, you can't force memory mapping without a developer getting into the act. Audacity uses generous memory anyway. It's the canary in the coal mine for a computer. If you have a bad stick up in high memory, you may just not know about it until you try to do Audacity production.

Koz

Re: Finding average RMS volume

Posted: Sun Oct 31, 2010 5:29 pm
by steve
guyburns wrote:File 1 – 52 minutes, 16-bit stereo (~550 MB)
Crashed while trying to calculate wave stats.
That does not surprise me. The calculation occurs in RAM - real RAM, not swap file, and if you run too low on available RAM then bang it crashes. The plug-in could be modified to work with long files, but the only way that I can think of doing that would make it very slow.
guyburns wrote: I was amazed. "A-weightings" and "RMS" values and all sorts of complicated calculations are not as good as simply looking at a waveform. Why is that?
Absolutely true - of course the best "measure" for loudness is by listening.
These "complicated calculations" are better than a peak level measurement, but they are still not fantastic.
guyburns wrote:This "denseness" I have mentioned -- how "dense" the sound appears on the screen -- how could that be quantified?
Not easily. There are many factors that affect the perceived loudness.

Here's a test that looks at peak level, A-weighted RMS and short sounds compared with longer sounds:
In this attached MP3 there are a series of sounds that are repeated for a total of 3 times.
  • The first time each of the sounds has the same amplitude (peak level). The different sounds are clearly very different loudness.
  • The second time, each sound has approximately the same A-weighted RMS level. I think that these sound much closer, but to me the higher tones toward the end of the sequence still sound noticeably louder.
  • The third time through the sounds are again (roughly) equal A-weighted RMS, but rather than constant tones they are short pulses. To my ear these sound roughly the same loudness.

Re: Finding average RMS volume

Posted: Mon Nov 01, 2010 12:10 pm
by guyburns
Thanks for the sound file. I did some testing with it. First I opened it in iTunes (so as not to see the waveforms) and gave each section of sound a volume rating from 1-5. The first sound in each version was rated at 3, then I increased or decreased the rating depending on whether the following sounds were louder or softer. Then I opened the file in Audacity to see if my volume ratings correlated with the "density" of the waveform I could see. And they did to a reasonable approximation.

In what follows, I have labelled the "hissing" sounds A, B, C, D, and the tones T1, T2, T3.

Here are my volume ratings (waveform unseen) for the three versions (Note - my extra spaces to make numbers line up have been deleted):

A B C D T1 T2 T3
3 5 4 3 3 4 2
3 3 3.5 4 3 4 2
3 2 3 4 3 4 2

For Sound A it was tricky to estimate how loud it would be just by looking at the waveform (due to the superimposed very-low frequency component), so I have not included it in the images below. The first image is how B, C and D looked in Audacity (first version), and if I was asked to estimate the volume of B, C and D just by looking at the waveform, B would be loudest, followed by C, then D. Which is how I rated them in iTunes (5, 4, 3).

Image


For the second version, my ratings were 3, 3.5 and 4, and in Audacity they look like this:

Image

There's not much between B & C, but C does "look" slightly louder because of the peaks.

For the third version, my ratings were 2, 3 and 4. Here they are in Audacity:

Image

Again, B and C look pretty similar, but on close inspection, C "looks" louder.

I'm intrigued by how closely the volume of some sounds can be estimated just by looking at the density of the waveform as displayed in Audacity. It seems to give a better approximation to perceived loudness than any other method other than actual listening. Is it possible to add to the Wave Stats plug-in a calculation that mimics this "density"? Could it be as simple as the average of the rectified waveform? If it can be coded, I'll test it on a wide range of music to see how it performs as a measure of perceived volume.

Re: Finding average RMS volume

Posted: Mon Nov 01, 2010 12:45 pm
by guyburns
I forgot something. In your reply you said to my query about how "density" could be calculated: "Not easily. There are many factors that affect the perceived loudness."

You may have misunderstood what I meant. I didn't mean how could perceived loudness be calculated, but how could a measure of the "density" of the waveform -- as it appears in Audacity -- be calculated so as to put a figure on it.

Re: Finding average RMS volume

Posted: Tue Nov 02, 2010 12:52 am
by steve
guyburns wrote:Could it be as simple as the average of the rectified waveform?
That's sort of what the RMS measure is.

It's interesting that you rated T1, T2, T3 at 3, 4, 2 in each case, even though the amplitudes are considerably different in the first sequence to their amplitudes in the second (and third) sequence.

Note also that a tone at 10 Hz, or at 25 kHz would have a loudness of zero. Although it is possible to feel 10 Hz vibrations, it's unlikely that your speakers are able to reproduce 10 Hz with any significant power. How "dense" does a 10 Hz, or 25 kHz tone look?

Re: Finding average RMS volume

Posted: Tue Nov 02, 2010 8:25 am
by guyburns
My volume estimates of 3,4,2 were for the tones were not estimates of relative loudness, simply a way for me to indicate whether a sound was louder or softer. So 4 could be ten times as loud as 3 or only 10% louder.

RE "density", the time scale has to be of a suitable value. I found that about 1 second per centimetre on my screen gave a good indication of how loud the sound would be.

Re: Finding average RMS volume

Posted: Tue Nov 02, 2010 7:08 pm
by steve
I've had an idea about how to measure "loudness". I'll try to knock up a demo plug-in in the next week or two, but if you're still interested and don't hear from me within two weeks feel free to 'bump' this topic (post a reminder).
In the mean time, if you're interested in doing a bit of reading on the subject, there's a relevant article on wikipedia:
http://en.wikipedia.org/wiki/Equal-loudness_contour

A quick thought to leave you with:
If someone is talking loudly, it doesn't really matter that most of the time the audio is at a very low level (gaps between words and sentences), they still sound "loud".

Re: Finding average RMS volume

Posted: Wed Nov 03, 2010 2:58 pm
by guyburns
Thanks for the Wikipedia links. Reading about loudness and the science behind it just leads me to conclude that there is too much regard given to pure tones and noise and not enough regard to real sounds, particularly music and speech.

Loudness is very subjective, of course, and I've found that it depends on the "transparency" of the sound (the opposite to "denseness), the amount of unnatural high frequencies, and the setting. Regarding the latter, most older people (those who like their music not too loud), seem to accept quite high volumes at the cinema without complaint, but the same volume at home would send them immediately to the volume control.

As for high-frequency distortion, for example in Pleasant Valley Sunday (Monkees), it is so unpleasant to me that it makes the music seem louder than it probably is. On the other hand, well recorded "transparent" music, such as On Top Of The World (Carpenters), which I regard as one of the best-quality recordings for a pop song, you can keep turning up the volume and it never seems to get to the unpleasant stage.

Without having listened in-depth to a wide variety of music and sounds so as to make a proper judgement, I think that the way Audacity presents its waveforms gives a good indication of perceived loudness. If that is the case, all you have to do is work out how Audacity presents the waveform on screen (at a suitable resolution that gives a good approximation to loudness), and quantify the "denseness".

What I'm going to do is to round up 5-second snippets of various sounds -- classical, popular, speech, TV ads -- both good-quality and poor-quality recordings, and generate three sound files in which each snippet is:

1. Adjusted for the same RMS value;

2. Adjusted for the same RMS A-weighted values;

3. Adjusted so the waveform in Audacity looks to have the same loudness.

I'll probably use a snippet from On Top Of The World as the reference between the different sounds, and then ask people to note whether a particular snippet is softer or louder than the reference. Then I'll run them through headphones and speakers and ask friends to rate the loudness, using a simple method like the Parson's code for melodies -- louder (L), softer (S), or no change (N).

Once the results are in, that should give a pretty good indication of which is the best method of determining loudness for real-life sounds. It may turn out there isn't a best method.

Re: Finding average RMS volume

Posted: Wed Nov 03, 2010 3:42 pm
by kozikowski
<<<Absolutely true - of course the best "measure" for loudness is by listening.
These "complicated calculations" are better than a peak level measurement, but they are still not fantastic.>>>

Which is what Chris did. He kept tweaking and listening until he got it to where he was happy. He did not start with advanced math and work down to the show. He started with the show and worked up to the programming.

There was a company a while back selling a more accurate version of the Fletcher-Munson loudness curves.

http://en.wikipedia.org/wiki/Fletcher%E ... son_curves

They didn't go anywhere, but it points up the idea that simple math doesn't lend itself to "music," even when you do all your research by observation.

And yes, the "density" of the waves is the RMS value. The size of the DC battery that has the same energy as the area under the curves. That value and the peak value are the some of the worst indicators of loudness even though they appear like they should work.

Koz