COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

How to compute RMS in frequency domain

• Follow

```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.

Afi
```
 0

```On 23 Jan, 15:37, "Afinko" <afi...@gmail.com> wrote:
> Hi,
>
> my question is very simple:
> How to compute RMS in frequency domain?

The same way that you compute RMS values in time domain?
The only problem would be to keep track of the odd scaling
coeffcient through the DFT, but you would have to consult
the docs for your FFT imp,ementation for that.

Rune
```
 0

```Parseval's Theorem.

message 6.

Greg
```
 0

```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
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
```
 0

```Jerry Avins <jya@ieee.org> wrote:
(snip)

> 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.)

Well, you can calculate RMS for any time duration you want,
including infinite for theoretical signals.

In many cases you want the shorter term version, though, I agree.

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
```
 0

```>
> I have a program that will compute the peak and RMS for a WAV
> file, such as recorded by a digital audio recorder. =A0I 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. =A0
>
> -- 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

```
 0

```Mark <makolber@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
```
 0

```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.

```
 0

```On Jan 23, 9:37 am, "Afinko" <afi...@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)

2222327db2ea7f51?hl=en

Hope this helps.

Greg
```
 0

```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
```
 0

```>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
>

I added this information also to the wikipedia:
http://en.wikipedia.org/wiki/Root_mean_square#RMS_in_frequency_domain
```
 0

```In article <a5b54ee5-fe98-4652-828c-
>
>
>
>>
>> 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.

http://en.wikipedia.org/wiki/Replay_Gain

```
 0

```>
> >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.
>
> http://en.wikipedia.org/wiki/Replay_Gain- Hide quoted text -
>

thanks Robert...

Mark

```
 0

```>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
>

In the RMS calculation if I include abs(X) at only few frequencies among
the entire range for which X has been evaluated, would it be equivalent to
applying band pass filter to the original time signal and then taking RMS
of it?

Rahul

```
 0

13 Replies
572 Views

Similiar Articles:

7/23/2012 5:43:45 PM