How metering is calculated...
How metering is calculated...
- Subject: How metering is calculated...
- From: Grant Robinson <email@hidden>
- Date: Fri, 26 Feb 2010 23:08:25 -0700
I have a cross-platform application that uses CoreAudio on OS X and
DirectSound8 on Windows. For metering on OS X, I am using the
built-in metering CoreAudio provides using the
kStereoMixerParam_PostAveragePower parameter. I have been unable to
find a corresponding API in DirectSound8, so I have been attempting to
mimic the values provided by CoreAudio and
kStereoMixerParam_PostAveragePower by calculating it from the raw
audio data. What I have seems to be partially correct, but doesn't
seem to "follow the music" as well the CoreAudio values. I am
wondering if any of the CoreAudio guys (or others on the list) have
experience with calculating these values and can provide some
pointers.
I have a couple of questions about the approach that should be taken:
1) I am currently taking the RMS of the audio values normalized to the
range -1.0 to 1.0, and then converting that to a logarithmic scale
using the formula:
20 * log10(rms/base)
for base I have tried 0.775 and 0.5 trying to match the values I see
from CoreAudio. Is this a valid approach? If not, what sort of
calculation should I be doing?
2) I am currently computing these values ahead of time in intervals of
anywhere from 20-100ms of time (which at the sample rate I am using
corresponds to anywhere from 882 to 4410 samples per channel), and
saving them off for queries that come later. The calculation for each
interval is independent of all the other intervals. Could this be my
problem? Do these values depend on the previously calculated values?
3) Related to #2, should I be calculating these values on-demand
instead of ahead-of-time? Given my question about dependence, is it
even possible to just calculate them on demand, or do I need to be
continuously calculating them?
I can post the code I have been working with if that would help
resolve any ambiguities. I've done quite a bit of reading about this,
but I haven't found any sites or articles that have been particularly
thorough, so I have had to try and piece things together. Any help
you can offer would be greatly appreciated.
Thanks!
--
Grant Robinson
email@hidden
_______________________________________________
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