• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: True RMS value for audio samples
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: True RMS value for audio samples


  • Subject: Re: True RMS value for audio samples
  • From: "B.J. Buchalter" <email@hidden>
  • Date: Mon, 9 Jul 2007 13:28:51 -0400

Hi Luigi,

Basically, you cannot make the optimization you are seeking to make. You need to compute the
true RMS with the moving average and then use that to drive your meter attack and release data.


Effectively, the problem is that you are re-peaking the meter too often (since you re-attack for any sample that is above your current RMS meter level). This is not going to give you an RMS measurement; it is a quasi-peak measurement, and this is why your meter reads too high.

Best regards,

B.J. Buchalter (author of SpectraFoo).
Metric Halo

On Jul 9, 2007, at 1:13 PM, Luigi Castelli wrote:

Hi there,

I am working on a true RMS detector and, even though it seems like an easy task to accomplish, I stumbled upon a problem I don't know how to solve.

I know the math for true RMS value detection is:

RMS(x) = sqrt( 1/N * � 0 to N (x[n] * x[n]) )

To implement the function efficiently I am not using a moving average window like the formula would indicate, but I am rather using a 1-pole lowpass filter to perform the averaging.
So my code looks something like:


float *in = invec;
float *out = outvec;
long n = blocksize;

float relaxcoeff = relax;
float clampcoeff = clamp;
float y0;
float y1 = prevsample;

while (n--) {

    float zin = *in++;
    y0 = zin * zin;

    if (y0 < y1) {
        y1 = y0 + relaxcoeff * (y1 - y0);
    } else {
        y1 = y0 + clampcoeff * (y1 - y0);
    }
    *out++ = sqrt(y1);
}

To make the algorithm conform to PPM metering I made the clamp time 10 ms and the relax time 1500ms both calculated over 20dB.
Now this works to a certain extent, however when compared to audio metering programs like Spectre or SpectraFoo the value reported by my algorithm is VERY different.
For the same audio material I get something 5-6 dB higher than what I read on those applications.


I would like to know from the experts (I know the author of Spectre reads this list) what I am doing that is giving me an inaccurate RMS value estimation.

Thanks a lot for your time.

Sincerely

- Luigi Castelli




------------------------------------------------------------


THIS E-MAIL MESSAGE IS FOR THE SOLE USE OF THE INTENDED RECIPIENT AND MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE INTENDED RECIPIENT, CONTACT THE SENDER BY E-MAIL AT email@hidden AND DESTROY ALL COPIES OF THE ORIGINAL MESSAGE. WITHOUT PREJUDICE UCC
1-207.



------------------------------------------------------------








______________________________________________________________________ ______________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
http://mobile.yahoo.com/go?refer=1GNXIC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

B.J. Buchalter Metric Halo http://www.mhlabs.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >True RMS value for audio samples (From: Luigi Castelli <email@hidden>)

  • Prev by Date: True RMS value for audio samples
  • Next by Date: AUAudioFilePlayer offline rendering
  • Previous by thread: True RMS value for audio samples
  • Next by thread: Re: True RMS value for audio samples
  • Index(es):
    • Date
    • Thread