Re: Calculating peak level in db
Re: Calculating peak level in db
- Subject: Re: Calculating peak level in db
- From: Gerd Castan <email@hidden>
- Date: Sun, 13 Oct 2002 09:27:14 +0200
Hi all,
James Chandler Jr wrote:
PeakDB = 20.0 * Log10(abs(MaxSampleValue));
This is what I was seeking for. Now I get the same
values the Delta Control Panel displays.
(=(20/ln(10))*ln(maxAbsSampleValue);
By the way, I don't calculate abs of the max sample value
but max of (abs of each sample value)
When you are notified of the samplerate of the audio, figure out how many
samples will fit in a 1/10th second interval, or however often you want to
update the on-screen meter. Every time a buffer comes thru your program,
scan the buffer looking for the max absolute value. After you have scanned
enough samples or buffers to exceed a 1/10th second interval, calculate
PeakDB = 20.0 * Log10(MaxSampleValue), and then schedule a process (or set a
flag, whatever) that will draw the current PeakDB to the on-screen meter.
I do it the other way round:
The recording thread updates max(abs(value)) per channel.
I have a second thread that asks for (and resets) these values 10 to 30
times a second and triggers a redraw.
Thanks to all,
Gerd
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.