• 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: Steve Bird <email@hidden>
  • Date: Mon, 9 Jul 2007 13:36:07 -0400

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

NIT: the index should vary from 0 to N-1, not from 0 to 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.

--- I am not an expert, but it looks like your filter applies a DIFFERENT coefficient depending on whether the instantaneous sample value is ABOVE or BELOW the current "average".  That is guaranteed to distort the signal.

I believe the "clamp" and "relax" timers should be applied AFTER the true RMS is computed, you can't do it this way.

If you're looking to speed things up, consider doing a moving average, but don't start from scratch every time.

If your block size is 100, then add up samples 0-99 and call it the total.
When sample #100 comes in, figure total = total - Sample #0 + sample #100, then divide by 100.
When sample #101 comes in, figure total = total - Sample #1 + sample #101, then divide by 100.
When sample #102 comes in, figure total = total - Sample #2 + sample #102, then divide by 100.
... and so on.


HTH

----------------------------------------------------------------
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com                     (toll free) 1-877-676-8175


 _______________________________________________
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: AUAudioFilePlayer offline rendering
  • Next by Date: Re: True RMS value for audio samples
  • Previous by thread: Re: True RMS value for audio samples
  • Next by thread: Re: True RMS value for audio samples
  • Index(es):
    • Date
    • Thread