RE: [linux-audio-dev] power computation

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: RE: [linux-audio-dev] power computation
From: MOULET Xavier CNET/DMR/ISS (xavier.moulet_AT_cnet.francetelecom.fr)
Date: pe maalis 03 2000 - 03:58:03 EST


example : 4+3=7, sqrt (4*4+3*3) = sqrt(25)=5
(just because (a+b)(a+b) = a*a + b*b .... +2*a*b.

Just remember, too, that another way to get the rmspower is to have the
module (absolute value, talking of complex numbers) of the continuous
component of the FFT of the signal squared. (Just for MP3 which is in the
frequency domain, for ex.)

if f is the signal, F = fft(f), rmspower = |F(0)|²

And we must remember that the power is NOT calculated in the terms of
sqrt(sum(each_sample*each_sample)) only if the signal has a zero mùean value
: if the signal f(t) = 1 (constant value), the power is zero because the
true formula is
sqrt (sum ((each_sample-mean_value) * (each_sample-mean_value)));

(which sums up in saying that in computer audio,
1) You should have to remove the DC bias before calculating rmspower
2) CPU - cycles speaking, signal processing sucks unless you make some -
false but hey get real - assumptions, here that DC bias is 0 for EVERY
signal.

BUT there are some algorithms to make things faster and more accurate. Most
of which use FFT & FIR filters by the way.

> -----Message d'origine-----
> De: Alexander Ehlert [mailto:ehlert_AT_phys.unsw.edu.au]
> Date: vendredi 3 mars 2000 07:55
> À: Paul Barton-Davis
> Cc: linux-audio-dev_AT_ginette.musique.umontreal.ca
> Objet: Re: [linux-audio-dev] power computation
>
>
> Hi Paul,
>
> > am i right in thinking that:
> >
> > rms_power = sum (fabs(each_sample))/n_samples
> >
> > is equivalent to:
> >
> > rms_power = sqrt (sum (each_sample * each_sample)) / n_samples
> >
> > it seemed to me that the first is computationally
> equivalent, but more
> > efficient; it seems to yield different results, however.
>
> You're wrong: sqrt(a*a+b*b) != a+b
> But it's tempting ;)
>
> Cheers, Alex
>
>


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:23:28 EST