Normalizing RMS to a specific A-Weighted db

  • Follow


Hello All,

I am attempting to normalize an audio file to a specific RMS decibel value
(A-Weighted).
I currently calculate calculate the A-Weighted RMS of an audio file. 
I calculate a scale factor by

scaleFactor = pow( 10.0,( newDecibelRMS - currDecibelRMS) / 20.0 ));

I then multiply the samples by the scaleFactor, which should bring the file
to the desired RMS decibel value.  The goal is to always have the file
normalized to newDecibelRMS.

I realized this works under certain cirmcumstances such as with white
noise, pink noise and single frequency files.

Any ideas on how to fix it so that the file is always set to the corrected
A-Weighted RMS value.


Thank you,


Waverly
0
Reply WaverlyE 10/15/2010 11:19:47 PM

On Oct 15, 7:19=A0pm, "WaverlyE"
<waverly.edwards@n_o_s_p_a_m.genesys.com> wrote:
>
> I am attempting to normalize an audio file to a specific RMS decibel valu=
e
> (A-Weighted).
> I currently calculate calculate the A-Weighted RMS of an audio file.
> I calculate a scale factor by
>
> scaleFactor =3D pow( 10.0,( newDecibelRMS - currDecibelRMS) / 20.0 ));
>
> I then multiply the samples by the scaleFactor, which should bring the fi=
le
> to the desired RMS decibel value. =A0The goal is to always have the file
> normalized to newDecibelRMS.
>
> I realized this works under certain cirmcumstances such as with white
> noise, pink noise and single frequency files.
>
> Any ideas on how to fix it so that the file is always set to the correcte=
d
> A-Weighted RMS value?

dunno what the meaning of the request is exactly.

are you wondering how to compute the A-weighted RMS of a (likely
windowed) segment of sound?  do you know how to A-weight filter it?
and how to compute RMS?  there are other "meter ballistics" issues to
settle.

then are you normalizing so that the maximum A-weighted RMS loudness
of the whole file is set to some specified level and the same
scaleFactor is applied to the whole sound file?  or are you trying to
do some level compression (varying scaleFactor)?

fwiw,

r b-j
0
Reply robert 10/16/2010 5:11:58 AM


>then are you normalizing so that the maximum A-weighted RMS loudness
>of the whole file is set to some specified level and the same
>scaleFactor is applied to the whole sound file?  or are you trying to
>do some level compression (varying scaleFactor)?
>

Yes, the end goal is normalizing so that the maximum A-weighted RMS
loudness of the whole file is set to a specified level.

I computed the A-weighted RMS but have not been able to determine how to
compute a scale factor that satisfies the requirements.  I find that if I
compute the unweighted RMS, 99% of the time I can convert the file to the
target RMS (unweighted).  The same is not true if my target is A-weighted. 
I am at a loss for how I would normalize so that the maximum A-weighted RMS
loudness of the whole file is set to a specified level.

Thank you,


Waverly
0
Reply WaverlyE 10/16/2010 12:13:43 PM

On Oct 16, 8:13=A0am, "WaverlyE"
<waverly.edwards@n_o_s_p_a_m.genesys.com> wrote:
> >then are you normalizing so that the maximum A-weighted RMS loudness
> >of the whole file is set to some specified level and the same
> >scaleFactor is applied to the whole sound file? =A0or are you trying to
> >do some level compression (varying scaleFactor)?
>
> Yes, the end goal is normalizing so that the maximum A-weighted RMS
> loudness of the whole file is set to a specified level.
>
> I computed the A-weighted RMS but have not been able to determine how to
> compute a scale factor that satisfies the requirements. =A0I find that if=
 I
> compute the unweighted RMS, 99% of the time I can convert the file to the
> target RMS (unweighted). =A0The same is not true if my target is A-weight=
ed.
> I am at a loss for how I would normalize so that the maximum A-weighted R=
MS
> loudness of the whole file is set to a specified level.
>

my understanding of what you're trying to do is come up with a single
scale factor that you apply to the whole sound file so that at the
point where the sound has the maximum RMS A-weighted loudness (however
that gets defined), that loudness is scaled to a predetermined value.
is that correct?

and my understanding is that you already know how to compute the
maximum RMS A-weighted loudness.  is that correct?

if both are correct, and given your formula first posted, then i do
not understand what the problem is.  it seems as though you've solved
all the pieces of the problem and you know how the pieces go together.

r b-j
0
Reply robert 10/16/2010 5:55:51 PM

>if both are correct, and given your formula first posted, then i do
>not understand what the problem is.  it seems as though you've solved
>all the pieces of the problem and you know how the pieces go together.

Unfortunately, it does not appear to work if I want to normalize to a
specific A-weighted RMS value.
The same process to normalize to a specific RMS for a unweighted audio only
works for some A-weighted. 

scaleFactor = pow( 10.0,( newDecibelRMS - currDecibelRMS) / 20.0 ));

for ( indx = 0; indx < numOfSamples; indx++)
     sample( indx )   = sample( indx )  * scaleFactor;

When complete the RMS of the file is newDecibelRMS

Applying the above works 99% of the time for unweighted samples.  Since
this does not consistently work for A-weighted files, my concern is that
because the weighting is not linear, then I dont have a way of determining
how to get the RMS to the desired level.  I've thought hard but havent come
up with anything, which is why I am asking for insights and help in any
way.


Thank you,


Waverly
0
Reply WaverlyE 10/16/2010 11:00:39 PM


robert bristow-johnson wrote:

> On Oct 16, 8:13 am, "WaverlyE"
> <waverly.edwards@n_o_s_p_a_m.genesys.com> wrote:
> 
>>>then are you normalizing so that the maximum A-weighted RMS loudness
>>>of the whole file is set to some specified level and the same
>>>scaleFactor is applied to the whole sound file?  or are you trying to
>>>do some level compression (varying scaleFactor)?
>>
>>Yes, the end goal is normalizing so that the maximum A-weighted RMS
>>loudness of the whole file is set to a specified level.
>>
>>I computed the A-weighted RMS but have not been able to determine how to
>>compute a scale factor that satisfies the requirements.  I find that if I
>>compute the unweighted RMS, 99% of the time I can convert the file to the
>>target RMS (unweighted).  The same is not true if my target is A-weighted.
>>I am at a loss for how I would normalize so that the maximum A-weighted RMS
>>loudness of the whole file is set to a specified level.
>>
> 
> 
> my understanding of what you're trying to do is come up with a single
> scale factor that you apply to the whole sound file so that at the
> point where the sound has the maximum RMS A-weighted loudness (however
> that gets defined), that loudness is scaled to a predetermined value.
> is that correct?
> 
> and my understanding is that you already know how to compute the
> maximum RMS A-weighted loudness.  is that correct?
> 
> if both are correct, and given your formula first posted, then i do
> not understand what the problem is.

The problem is the scaled peaks are getting clipped; so here we go.

>  it seems as though you've solved
> all the pieces of the problem and you know how the pieces go together.

He is imbecile. Why bother?

VLV


0
Reply Vladimir 10/16/2010 11:01:13 PM

>The problem is the scaled peaks are getting clipped; so here we go.
>

You are correct.  After I read this I went back and tested all my samples
and the ones that did not scale to the correct RMS were being clipped.    

>He is imbecile. Why bother?
>

I could have done without the portion of being called an imbecile.  It was
an oversight that threw off my results and I drew the wrong conclusion from
those results.  I have since put in a safeguard to warn me if clipping
would occur during normalization.

I thank you kindly for pointing out the error in my thinking


Waverly
0
Reply WaverlyE 10/17/2010 4:10:31 AM

On Oct 17, 12:10=A0am, "WaverlyE"
<waverly.edwards@n_o_s_p_a_m.genesys.com> wrote:
>
> I could have done without the portion of being called an imbecile. =A0It =
was
> an oversight that threw off my results and I drew the wrong conclusion fr=
om
> those results. =A0I have since put in a safeguard to warn me if clipping
> would occur during normalization.
>
> I thank you kindly for pointing out the error in my thinking

not that it's written in the comp.dsp constitution or anything, but a
de facto price one pays for getting help here is that Vlad will be
highlighting one's inadequacies.  at least those he believes he sees.
i might suggest toughening up one's skin and just come back for more.

i have gotten into a few nasty fights here, but it's usually when a
self-assessed know-it-all takes issue with something that is very
conservative that i or someone else has written.  i don't have any
problem with noobs or anyone else with real questions.

r b-j
0
Reply robert 10/17/2010 5:53:18 AM

>... i don't have any problem with noobs or anyone else with real
questions.

You were correct that I had all the pieces to the puzzle.  I just wasnt
seeing the error I was generating.


Thank you very much for your help.


Waverly
0
Reply WaverlyE 10/18/2010 2:10:09 PM

8 Replies
355 Views

(page loaded in 0.084 seconds)

Similiar Articles:













7/26/2012 8:23:03 PM


Reply: