• 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: Ian Kemmish <email@hidden>
  • Date: Mon, 9 Jul 2007 20:11:44 +0100


On 9 Jul 2007, at 2:11 pm, "B.J. Buchalter" <email@hidden> wrote:



Yes, to
speed things up, I thought of doing a moving average like you
suggested, however what kept me from going ahead and implementing it,
is the concern that - doing it that way - I am gonna encounter
round-off error problems really soon, because I am performing 44100
additions and 44100 subtractions per second on the same number.

What's your take on that ?

If you really want a moving window it is not a problem; just don't divide the accumulator variable (do the divide on the accumulator when you present the data) You are processing fixed point values (even if you are doing it with floats) -- the adds and subtracts are exact.


I'd say that you can't guarantee that there won't be loss of precision that way. To guarantee that, you would need to know that the samples you were summing were originally calculated to no more than 8-9 bits of precision. (24 bits for a float mantissa less the 15-16 bits of headroom you need to sum 44100 of them). Any more than that and the least significant bits of the sum will get lost as the sum grows.

The simplest way to ensure that there is no loss of precision is to convert each incoming sample to an appropriately scaled integer (with sufficient headroom to account for the number of samples you intend to sum) *before* storing it in your ring buffer.


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ian Kemmish 18 Durham Close, Biggleswade, Beds SG18 8HZ
email@hidden Tel: +44 1767 601361 Mob: +44 7952 854387
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



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