Help - Search - Members - Calendar
Full Version: How to calculate average db level?
Hydrogenaudio Forums > Hydrogenaudio Forum > General Audio
ZinCh
Hello

How I can calculate average db level from audio file?
Dynamic
dB is a relative, not an absolute measurement - so you have to compare against something else.

However, you can define something to measure relative to. It would help to know your purpose.

For example, Replaygain scanning (e.g. in foobar2000, or format-specific apps like wavgain, mp3gain, etc) measures a good estimate of perceptual loudness. Some interfaces report the loudness figure, while some only report the 'correction' required to adjust the file to the standard level.

What it measures loudness relative to is a pink noise sample used to calibrate loudness to 83 dB SPL (sound pressure level), which has a precise measurable meaning. The target loudness is normally 89 dB SPL. The loudness you achieve depends on your volume control, unless you have fixed it at a level calibrated to this reference.

Other methods use simple non-perceptual RMS measures.
Martel
QUOTE(ZinCh @ May 16 2008, 14:14) *

Hello

How I can calculate average db level from audio file?

You mean amplitude level or RMS power?
If you want to calculate the latter, I would try the formula

rmspow(dB) = 10 * log10 (sqrt (sum(sample[i]^2)/total_samples)/max_sample_value)

It should give you the average RMS power with reference to a full amplitude square wave (maximum achievable power). I'm not totally sure about the formula, though. smile.gif
Nick.C
QUOTE(Martel @ May 17 2008, 08:18) *
QUOTE(ZinCh @ May 16 2008, 14:14) *
Hello

How I can calculate average db level from audio file?
You mean amplitude level or RMS power?
If you want to calculate the latter, I would try the formula

rmspow(dB) = 10 * log10 (sqrt (sum(sample[i]^2)/total_samples)/max_sample_value)

It should give you the average RMS power with reference to a full amplitude square wave (maximum achievable power). I'm not totally sure about the formula, though. smile.gif
Or.... rmspow(dB) = 20 * log10 (sum(sample[i]^2/total_samples)/max_sample_value) to save a sqrt operation....
ZinCh
I have DVD with 2 audio tracks, english 5.1 and other language 2.0, and I want to make 5.1 other language track by replacing central channel in 5.1

but when I decode everything to mono WAVs, I found that they (central english channel and downmixed to mono language track) have different volume level, and I need to calculate somehow difference between them

how it will be better to do that?
Martel
QUOTE(ZinCh @ May 17 2008, 00:33) *

I have DVD with 2 audio tracks, english 5.1 and other language 2.0, and I want to make 5.1 other language track by replacing central channel in 5.1

but when I decode everything to mono WAVs, I found that they (central english channel and downmixed to mono language track) have different volume level, and I need to calculate somehow difference between them

how it will be better to do that?

If you need just a software that can measure that... The easiest way I can think of is to use Foobar 2000 player, right click the track and select replaygain->scan per-track file gain, then right click again and choose properties. There you will see something like this "replaygain_track_gain = +5.35 dB" (the number will, of course, vary). Do this for both the tracks and just subtract the values and you will obtain the gain you need to apply to the other track to achieve comparable loudness.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.