Comparing the loudness of two samples

I have two wave files each containing a sample of a note. I wish to compare, using a program, each sample and present how loud the first sample is with respect to the second if each sample is played back to the listener with the same physical conditions (volume, distance from speaker etc.). For example, if the second sample is twice as loud as the first, I wish to present "2" to the user. I'm not interested in being very accurate. I simply want to give a reasonable estimation.

Lets say the first file contains only a 1kHz tone with an amplitude of 0.1 (0.1*sin(2*pi*1000*t)), while the second contains a 1kHz tone with an amplitude of 1.0 (1.0*sin(2*pi*1000*t)). So the difference is 10db correct? Does this mean that the second sample will be, roughly speaking, perceived as being twice as loud, with respect to the first?

I understand that phons are with respect to spl and that therefore if I have only the two wave files to work with, I can't talk in such terms since I've no idea what spl existed at the microphone when the recordings were made - or more importantly, the spl that exists at the listeners ears when they hear the recording. However, lets say I have a 3kHz tone with an amplitude of 1.0 (1.0*sin(2*pi*3000*t)) in my first wave file, while the second file contains a 10kHz tone with an amplitude of 1.0 (1.0*sin(2*pi*10000*t)). Isn't it fair to say that the first file will be perceived as being louder? Should it be fair, based on the graph to say that the 3kHz tone will be perceived as being roughly 4 times louder? Since in the graph you have to, roughly speaking, increase the 10kHz signal by 20db to get the same loudness as that of a 3kHz signal.

Again lets say that the first file contains a 3kHz tone with an amplitude of 0.1 (0.1*sin(2*pi*3000*t)), while the second contains a 10kHz tone with an amplitude of 1.0 (1.0*sin(2*pi*1000*t)). Is it fair to estimate that the difference in loudness is a factor of 0.5? That is, the first file will be perceived as being twice as loud as the second.

• There are a lot of questions in here. This is partly a signal processing problem but also involves acoustics and psychoacoustics. I believe your first calculation should give a 20 dB difference 20*log10(1/0.1). This example might give you the perceived doubling in level, if you make loads of assumptions about your room and loudspeaker Dec 10, 2013 at 11:04

This is tricky. Loudness is a very complicated perceptual phenomenon and playback of sound in a room is a very complicated physical phenomenon. To do this right, you would need calibrated sound pressure signal measurements at the listener's ears and then run these through a suitable perceptual model (here is a good overview article: http://www.tcelectronic.com/media/1014016/skovenborg_2004_loudness_m.pdf)

For sine waves you could use the ISO 226 curves but with calibrated signal they are only correct for 1kHz. Let's say compare to sine waves at 200 Hz and one has ten times the amplitude: If playing back the first one 30 dB SPL the second one will be about 4 times louder. If you do this at 80 dB SPL the second will only be 3 times as loud at best. This gets even more complicated when multiple frequencies are involved.

Things get a lot more messy if you include the playback system as well. For pure sine waves the perceived loudness (and energy at the ears) can vary by as much as 30 dB (factor of 8 or so) just by moving a few centimeters. That's a basic effect of room acoustics. Furthermore most playback systems are fairly non flat (either by design or by sloppiness). Most cheap set of computer speakers will not provide a lot of output at 10 kHz.

Your best shot is probably to assume the signal are "normal" (music, speech, something broad band), apply an A-weighting, assume some average playback level and calculate a loudness difference from there. This is a gross simplification but depending on the application this may or may not be good enough.

Agreed this is tricky. One approach to estimate loudness using rms averaging is well described here:

BS.1770 : Algorithms to measure audio programme loudness and true-peak audio level https://www.itu.int/rec/R-REC-BS.1770/en

https://www.itu.int/rec/R-REC-BS.1770-4-201510-I/en