How to measure the dynamic range ?


I am new using audacity 2.0.5 under os 10.9.1.

In a thesis work, I have to analyse background noises (cocktail party, 12 talker bable, pseudovoice…) used for hearing in noise tests. In particular, I am interested in the rms value and the dynamic range (variation of levels: min/max).

I have read the FAQ, looked into the forum for similar questions, goggled a lot but did’nt find a way to achieve that properly.

Any help appreciated (I would not want to have to buy a commercial software to achieve that)

Thanks in advance


Try the “Contrast” tool

Thanks for your help

As I understood and tested the contrast tool, it will compare 2 sections (eg one with speech versus one with noise).

However my purpose is to caracterize only the background noise which is a 4 talker babble (rms; dynamic range: max level, min level).

I am not sure that the “contrast analyze” can do that or I don’t how…

Correct me if I am wrong



Select the quietest part of the recording and use this as the “background” level. This is the low end of the dynamic range.
Select the loudest part of the recording and use this as the “foreground” level. Thus is the high end of the dynamic range.
The difference of these two values is the dynamic range.
The value given by the “Contrast” tool is the RMS value.

To me, the dynamic range is defined by the audio’s bit depth, e.g. 0 dB to -96 dB (For 16 bit). The dynamic range for a specific audio file is therefore: the highest RMS value present minus the lowest representable, non-zero (-inf dB) RMS value.
For example:
24 bit with 6 dB head room:
-6 dB minus -144.5 dB = 138.5 dB Dynamic Range.
Note: this those are actually peak values, rather than RMS, just for simplicity sake

However, you are rather interested in a kind of signal-to-noise ratio.
The contrast tool would spit out this measure if you select the useful signal and then pure noise. This may give you a value of 40 dB difference.
Or you do it with fore- and background audio, in which case the difference will be less.

This measurement is misleading because the foreground has most likely quiet passages inbetween.

I think that the only senseful measurement is a histogram of all RMS values. You would simply count how many times a certain RMS value is present in the signal, if measured 100 times per second or so.
Something like:

   0 dB -
 -10 dB |
- 20 dB |||
-30 dB ||
-40 dB |||
-50 dB|||
-60 dB ||
-70 dB ||||
-80 db ||||||
-inf  ||||||||| (the silent parts)

The local peaks should now represent the different layers, namely foreground, background, noise, silence (and dither noise) and perhaps more.
This is a statistical approach that is often taken to refine blind source separation, i.e. separating voice and ambient noise. It assumes that pure voice has a different distribution than other audio.

To make this curve comparable, you should provide different samles such as pure noise, pure environment noise, instrumental music, narrated texts and of course the files you actually want to analyze.

By the way, those tactics could also be employed for an “ideal”, automatic dynamic compression for audio books and alike.

That is a rule of thumb calculation for the dynamic range of an audio format.
Using dither, sounds that are less than this calculated value can be represented.

All those calculations are pure mathematical playing around, especially if we deal with digital data.

Heisenberg’s uncertainty principle strikes wherever it wants…

Thanks for your replies.

I think I didn’t explain enough clearly the situation:

In a speech in noise hearing test, the subject hears speech material (sentence, word…) with a competing background noise. Depending on the SNR, the task is more or less easy.

Historically, steady state noise or equivalent (speech noise) were used because as they were no variation of level, it was easy to calibrate (and precise and small SNR could be used.

We know that introducing temporal fluctuations increases the intelligility of speech in noise. However if the background noise “fluctuates” too much there is a risk of lack of reproductibility of test retest especially at low SNRs.

I have a background which has been constructed with four talkers (2 french, 2 english speakers) and I would like to caracterize this background noise to be sure that it fullfills the above criteria. It is not possible to select a part of the background noise to compare it to another part.

Thanks for the help

You will need to explain that. I’ve shown how to measure RMS levels, which is what you initially asked for, but if that is not what you want to measure then what is it that you want to measure?

It is nearly impossible to select manually a quietest part and a loudest part within this babble since it has been constructed to be a continuous multitalker babble with normally “low” variations of levels. If there is too many variations of levels in the background noise, it is then difficult to test the hearing of speech at small signal/noise ratios.

I just want to check the amount of these variations what I called dynamic range by assimilation to what we say concerning the normal dynamic range oh hearing (0-120 dB Heraing Level). It is certainly not an adequate term for audacity gurus. Sorry about that! but the difference between the quietest and the loudest parts of the recording is exactly what I want to measure.

“Sound level” is never instantaneous. It is always measured with reference to a “time frame” (often called a “window”). There are a number of standard “windows” used for measuring “sound pressure level”. “RMS” (root mean square) is a common method for measuring audio signal levels, but as the name suggests it is a “mean” (average) measurement over a period of time. An RMS measurement can only be made over a specified time period.

“Instantaneous sound pressure” is not a measure of loudness, but is simply the difference between the (air) pressure from the average surrounding pressure due to a sound wave. For your measurements the “effective sound pressure” is more relevant, and this is the RMS of the instantaneous sound pressure over a given interval of time.

For your thesis you will need to either use a recognised standard measurement, or define your own measurement. If you can tell us exactly what you want to measure then we can probably tell you how to measure it. We cannot tell you what the most appropriate measurement will be for your thesis, though we may be able to make suggestions.

That “120 dB” range is probably not a “normal dynamic range of hearing”. After just a short period of listening to very loud sounds, ears become desensitised and are not able to hear very low level sounds until they have time to recover, In extreme cases, permanent hearing damage will occur and the ability to hear quiet sounds will never return. There is some good information about this in this Wikipedia article: Sound pressure - Wikipedia

and I’ve already described one way to do that, but not the way that you want.
What do you want? How about RMS measurements for each 100 ms which you can then analyze statistically?

If you run this code in the Nyquist Prompt effect (Audacity Manual) and apply to a short mono track, it will create labels at intervals of 0.01 seconds (100 ms) showing the RMS level in dB for that 0.01 second window.

(let* ((labels ())
      (rmss (rms s))
      (sr (snd-srate rmss)))
  (do ((i 0 (1+ i))
       (val (snd-fetch rmss)(snd-fetch rmss)))
      ((not val) labels)
    (setq val (linear-to-db val))
    (push (list (/ i sr) (format nil "~a" val))

The label track can be exported as a text file (File menu > Export Labels) which you can then analyze in any way that you want.

I tested this code steve and got labels every 100 ms. I exported the labels to excel to look at the distribution, minimum (-20.4072) and maximum (-33.842) values.

I would have thought that the dynamic is 33.842-20.4072=13.4348. However, it looks too simple. :unamused:

My interpretation is that we are not talking about the same dB. I guess that you are dealing with dB FS.

I understood that 0 dBFS is the level of a signal that is at the maximum level your system can cope with without clipping the tips of the waveform. So these values should be 10 x log of the ratio like for dB SPL (but dB SPL is re 20 micro pascal).

However, my goal is to look at the dynamic in terms of dB SPL (linear if possible, but A weighted or C weighted welcome). I need to understand more the relationship between these concepts. Not so easy…

I have attached 5 sec of the noise, you will understand why it was not easy to select a quiet and a loud part to use the contrast tool !

Thanks steve for giving some of your time

That’s what I got too.
Yes, that is correct.



The power ratio is expressed as 10 x log of the ratio.
The “Gain” or amplitude ratio is expressed as 20 x log of the ratio.

dBSPL is never “linear”, it is a logarithmic scale. I think what you mean is “unweighted” (Z-weighting) rather than “linear”.
The term “linear weighting” was used by some manufacturers in the past, but is rather misleading, so “zero weighting” or “Z-weighting” are preferred (standard) terms.

There is information about “Equal Loudness” here: Equal-loudness contour - Wikipedia

It is not possible to draw a direct correlation between SPL and RMS FS without a calibrated system, and even then you need to ensure that both are measuring the same thing (same microphone frequency response, same window function, same weighting, same audio signal).

You are right “zero weighting” is more correct. We should use that term.

I understood that the “real physical” dynamic range depends on physical measures with the sonometer but I was thinking that it could be anyway a relationship between levels of signal and the real life!

What I will do is to introduce at the beginning of my noise an 1000 Hz tone. I will adjust the rms levels of both (1000 Hz and background noise) and play that stuff in our isoled sound booth to measure it with the sonometer (with different weighthing filters). If I follow the ISO rules, I should use the C weighting filter.

Anyway, I am convinced of the power of audacity and the dynamism of the community. I have to go deeper into Nyquist code now :unamused:

Thanks again.

It depends what you want.

We often get asked “how can I measure the SPL with Audacity” and the answer is that you can’t, unless you have a calibrated system, which requires an accurate SPL meter and that was what they were wanting to avoid.

On the other hand, if you only need to know about relative changes, then there is no problem. Assuming that the analogue equipment is reasonably linear in its response (should be close enough as long as the sound is not massively loud or extremely quiet) then a change in SPL will cause an equal change in signal level in dB (not linear scale). Thus a 6 dB FS change in signal level corresponds to a 6 dB change in SPL (both with the same weighting). So your dynamic range measurements are valid for the acoustic (SPL) dynamic range.

In order to get A-weighted, the recording should be filtered with an A-weighting curve filter before you make the measurements. This can be done using the Equalization effect Audacity Manual. (similarly for other weightings). Unfortunately no-one has yet posted a preset for A-weighting, but if you read the section about presets you may be able to work out how to do that - give a shout if you need help.

I will check that and give feedback.

Thanks for the support

Please do. I don’t have an SPL meter so it will be interesting to see how good or bad the correlation is. The real “fun” part will be in comparing like with like.
There is information about different types of SPL measurement here: Sound level meter - Wikipedia
Note in particular the parts about time averaging.

I am pretty sure that there’s already such a preset (A-weighted) in this forum, leastways I’ve installed it some time ago.