Re: Getting average power / peak power (sound monitoring)
Re: Getting average power / peak power (sound monitoring)
- Subject: Re: Getting average power / peak power (sound monitoring)
- From: Jerry Krinock <email@hidden>
- Date: Mon, 19 Jun 2006 16:33:31 -0700
- Thread-topic: Getting average power / peak power (sound monitoring)
on 06/06/19 12:45, Neil Clayton at email@hidden wrote:
> Does anyone know how to get a level (avg power, peak power) meter
> reading from some kind of sound input device?
If CoreAudio is too heavyweight, and no one on the list offers a better
solution, you roll your own algorithm...
Average Power: Average of the squares of the magnitude samples over a given
period, the "window". In real time, as each new sample appears, you
subtract the oldest sample from the sum and add in the new one. For further
smoothing, process the result with an first-order infinite impules response
(IIR) filter.
Peak Power: Same idea, except you use the maximum of the squares
(MAX(newSampleSquared,oldMaxSquare)) instead of their average.
In either case, you adjust the window length and IIR filter time constant
("beta" factor) to get the desired smoothing, which depends on how often
you're going to update your display.
Probably the most fun you'll have all week!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden