Re: How metering is calculated...
Re: How metering is calculated...
- Subject: Re: How metering is calculated...
- From: Grant Robinson <email@hidden>
- Date: Mon, 1 Mar 2010 11:07:51 -0700
Forgot to do "Reply All". Woops. :)
On Mon, Mar 1, 2010 at 10:38 AM, Brian Willoughby <email@hidden> wrote:
> You left out a critical aspect of your algorithm. The 'M' in RMS stands for
> Mean, but you don't mention how you are calculating the mean. I suspect
> this is where your problem lies.
>From what I have read, RMS is the square root of the mathematical mean
of the sum of the values squared. So, for each channel, I do the
following:
float sum = 0.0;
while (looping) {
int16_t val = *data;
float normalVal = val / 32767.0;
sum += (normalVal * normalVal);
numSamples++;
}
float rms = sqrtf(sum/numSamples);
float power = 20*log10f(rms/base);
>
> Also, I am surprised that you mention 'normalized.' In my book, that is a
> verb, so I am concerned that you are normalizing the values, which would
> alter them. In other words, 'normalized' usually refers to a process, so
> you should be clear as to whether you are processing the values in some way
> at that stage.
>From my understanding, raw 16-bit signed integer audio values are a
fixed-point number representing the voltage at the time the audio
stream was sampled. So, by normalizing, I mean turning it from a
fixed-point integer number into a float decimal number in the range
-1.0 to 1.0 (which you can see in the above calculation). Is that
more-or-less correct?
Thanks,
Grant Robinson
_______________________________________________
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