Re: Signal to Noise Ratios / Intensity Normalisation
Posted: Wed May 04, 2011 8:30 pm
For the noise track, that's not a problem.RobH_Lab wrote: Is there anyway of editing this code so that it sets the mean RMS level of a track to the specified value?
Create a noise track (Generate menu > Noise) as long as you like (within reason)
Select the entire track and apply the effect.
The "gain" (amplification) is calculated based on the first one second, but is then applied to the entire selection. Because the noise is constant throughout the duration of the track, all of the track will have the same RMS level.
For the "words" recording, it is a bit more complicated.
Lets say that you have one track that is a recording of someone quietly saying:
"mumble mumble mumble whisper whisper mumble mumble mumble mumble whisper whisper mumble mumble mumble"
Let's say you have another track where someone shouts:
"ONE......................................(long pause)...........................................................TWO"
Question: which is the loudest?
Clearly the second one will be a lot louder for the duration of each word, but the overall average may be greater for the quiet but continuous mumbling.
For normal speech, much of the recording will be silent, so measuring the "mean RMS level of a track" is less about the loudness of the voice, and more about the proportion of words to silence. I chose "1 second" as an approximation to "an average word length" so that it will provide a reasonable, quantifiable measure of the loudness of a word.
Yes. The last number (100) is the length of the section that is measured in hundredths of a second.RobH_Lab wrote: is there any way of changing the length of section it works on (i.e. from 1s to 2s)?
The code works like this:
- The RMS level is calculated 100 times per second for a given period. In effect, the audio is "sliced" into sections of 0.01 seconds duration, and the RMS level is calculated for each slice.
- For the code given there are 100 "slices" of 0.01 seconds each
- The maximum of these RMS values is then found.
- An "amplify" amount is then calculated, based on the RMS value found in the previous step and the "target" level.
- The entire audio selection is then amplified by that amount.
To test the first 200 slices (2 seconds), just change the last number to 200 like this:
Code: Select all
(setq target-level -12)
(mult s (/ (db-to-linear target-level)(peak (rms s) 200)))