Sign in

username:

password:



Not a member?

Search compdsp



Search tips

comp.dsp by Keywords

Adaptive Filter | ADPCM | ADSP | ADSP-2181 | Aliasing | AMR | Anti-Aliasing | ARMA | Autocorrelation | AutoCovariance | Beamforming | Bessel | Blackfin | Butterworth | C6713 | CCS | Chebyshev | CIC Filter | Circular Convolution | Code Composer Studio | Comb Filter | Compression | Convolution | Cross Correlation | DCT | Decimation | Deconvolution | Demodulation | DM642 | DSP Boards | DSP/BIOS | DTMF | Echo Cancellation | Equalization | Equalizer | ETSI | EZLITE (Ez-kit Lite) | FFT | FFTW | FIR Filter | Fixed Point | FSK | G.711 | G.723 | G.729 | Gaussian Noise | Goertzel | GPIO | Hilbert Transform | IFFT | IIR Filter | Interpolation | Invariance | JTAG | Kalman | Laplace Transform | Levinson | LPC | McBSP | MIPS | Modulation | MPEG | Multirate | Notch Filter | Nyquist | OFDM | Oversampling | Pink Noise | Pitch | PLL | Polyphase | QAM | QDMA | Quantization | Quantizer | Radar | Random Noise | Reed Solomon | Remez | Resampling | RTDX | Sampling | Sharc | TI C6711 | Undersampling | Viterbi | Wavelets | White Noise | Wiener Filter | Windowing | XDS510PP | Z Transform

Sponsor

Industry's highest performing at the lowest power DSPs now as low as $5.00*
Start development today!
*volume pricing for 10ku

Discussion Groups

Free Online Books

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Comp.DSP | Normalizing RMS to a specific A-Weighted db

There are 9 messages in this thread.

You are currently looking at messages 0 to 9.


Normalizing RMS to a specific A-Weighted db - WaverlyE - 2010-10-15 19:19:00

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
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Normalizing RMS to a specific A-Weighted db - robert bristow-johnson - 2010-10-16 01:11:00



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
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Normalizing RMS to a specific A-Weighted db - WaverlyE - 2010-10-16 08:13:00

>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
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Normalizing RMS to a specific A-Weighted db - robert bristow-johnson - 2010-10-16 13:55:00

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
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Normalizing RMS to a specific A-Weighted db - WaverlyE - 2010-10-16 19:00:00

>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
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Normalizing RMS to a specific A-Weighted db - Vladimir Vassilevsky - 2010-10-16 19:01:00


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


______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Normalizing RMS to a specific A-Weighted db - WaverlyE - 2010-10-17 00:10:00

>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
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Normalizing RMS to a specific A-Weighted db - robert bristow-johnson - 2010-10-17 01:53:00

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
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.

Re: Normalizing RMS to a specific A-Weighted db - WaverlyE - 2010-10-18 10:10:00

>... 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
______________________________
New DSP Code Snippets Section now Live.   Learn more about the reward program for contributors here.