From: Mark on

>
> I have a program that will compute the peak and RMS for a WAV
> file, such as recorded by a digital audio recorder.  I sometimes
> try to use the peak and RMS to equalize the level between tracks,
> but it isn't quite as easy as I might like.  
>
> -- glen

Glen...

you are doing this i presume to attempt to equalize the "loudness"
between tracks..

I'm sure you have found that equalizing the peak does not do a good
job of equalizing loudnes..

How well do you find the RMS works for this?

My guess is it would work pretty well as long as there are no long
periods of silence in the track.

Mark





From: glen herrmannsfeldt on
Mark <makolber(a)yahoo.com> wrote:

>> I have a program that will compute the peak and RMS for a WAV
>> file, such as recorded by a digital audio recorder. ?I sometimes
>> try to use the peak and RMS to equalize the level between tracks,
>> but it isn't quite as easy as I might like. ?

> you are doing this i presume to attempt to equalize the "loudness"
> between tracks..

Yes.

> I'm sure you have found that equalizing the peak does not do a good
> job of equalizing loudnes..

If I do the recording without changing the record level then it
would seem that not changing the relative level would be right,
even though the RMS and peak might change. That is, represent
the level variations of the original.

Also, my current system allows for level changes in multiple
of 6dB. (Also known as bits.) It isn't hard to change that,
but I haven't done it yet.

> How well do you find the RMS works for this?

Lately I consider both peak and RMS.

> My guess is it would work pretty well as long as there are no long
> periods of silence in the track.

Most of it is classical music, which can have long periods of lower
levels and then loud endings.

I believe it is more usual to do a weighted RMS but I haven't
done that yet, either.

-- glen
From: Richard Owlett on
Jerry Avins wrote:
> Afinko wrote:
>> Hi,
>>
>> my question is very simple:
>> How to compute RMS in frequency domain?
>> I do NOT want to transform signal to the time domain by inverse DFT(FFT)
>> and compute then the RMS.
>> Is there a way, how to compute RMS directly in frequency domain?
>> The signal is general (random), not only sine waves.
>
> RMS applies to a short-time mean; on the order of the longest period in
> the (time) waveform. Define carefully what RMS means in the frequency
> domain and the kind of calculation you want will probably be clear. (I
> suspect that the meaning will always remain murky except in certain
> special cases.)
>
> Jerry

I think I'll sort-of disagree (was that weasel worded ;)

I suspect the OP didn't use the optimum phrasing of his
question/problem.

I think he has a frequency domain representation of a signal
(probably complex) and is looking for its absolute value as a
function of frequency.

From: Greg Heath on
On Jan 23, 9:37 am, "Afinko" <afi...(a)gmail.com> wrote:
> Hi,
>
> my question is very simple:
> How to compute RMS in frequency domain?
> I do NOT want to transform signal to the time domain by
> inverse DFT(FFT) and compute then the RMS.
>
> Is there a way, how to compute RMS directly in frequency
> domain? The signal is general (random), not only sine
> waves.

X = fft(x)

Parseval's Theorem

sum(x.^2) = sum(abs(X).^2)/N

RMS == sqrt(sum(x.^2))/N) = sqrt(sum(abs(X/N).^2))

For details see (the URL is wrapped)

http://groups.google.com/group/comp.soft-sys.matlab/msg/
2222327db2ea7f51?hl=en

Hope this helps.

Greg
From: Afinko on
Thank you Greg.

With Parseval's theorem it works great.
I am attaching MATLAB code for verification:

f1 = 50; % [Hz]
fs = 10000; % [Hz]
t_max = 1; % [sec]

x = sin(2*pi*f1*(0:1/(fs-1):t_max));
% x = randn(10000,1); % It works for any input
X = fft(x);

RMS_t = sqrt((sum(x.^2))/length(x));
RMS_f = sqrt(sum(abs(X/length(X)).^2));

error = RMS_t - RMS_f

error =

1.8874e-015