AVAudioPlayer peakPowerForChannel decibel

Member
Posts: 164
Joined: 2010.10
Post: #1
i have some doubt about this method. i report what is in library peakPowerForChannel:
A floating-point representation, in decibels, of a given audio channel’s current peak power. A return value of 0 dB indicates full scale, or maximum power; a return value of -160 dB indicates minimum power (that is, near silence).

If the signal provided to the audio player exceeds ±full scale, then the return value may exceed 0 (that is, it may enter the positive range).

i have made some tests, the maximum (0) is returned very soon, i say a letter with normal voice, and 0 is very soon reached...
if i shout laud 0 is returned...

another doubt is this:
http://it.wikipedia.org/wiki/Decibel

90dB is a shout, 60dB a conversation...so...what is the value returned?
dB what?
"If the signal provided to the audio player exceeds ±full scale, then the return value may exceed 0 (that is, it may enter the positive range)."
i was not able to make it go over 0...

thanks
Quote this message in a reply
Moderator
Posts: 453
Joined: 2008.04
Post: #2
The decibel is a _relative_ unit. The English wikipedia says:

"The decibel is commonly used in acoustics to quantify sound levels relative to a 0 dB reference which has been defined as a sound pressure level of .0002 microbar"

And that's consistent with these examples:
http://en.wikipedia.org/wiki/Sound_press...ure_levels

That page has a big list of sounds and their _relative_ volumes. I'm not sure how the decibel is portrayed on the Italian page, since I can't read it.

I guess the main thing to understand is that higher values returned from that method will mean a louder volume, but they are purposefully not providing a reference value. It's not so much to be used as a volume checking device... but instead to measure relative volume.

Howling Moon Software - CrayonBall for Mac and iPhone, Contract Game Dev Work
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #3
(Dec 1, 2010 10:38 AM)AndyKorth Wrote:  I guess the main thing to understand is that higher values returned from that method will mean a louder volume, but they are purposefully not providing a reference value. It's not so much to be used as a volume checking device... but instead to measure relative volume.

ok, but at this point, i have -160 as a minimum (silence), 0 as max...
it's ok for me but the max is reached as i talk.
i'd like to have something like:
-160 noone is talking
-100 somone is talking
-50 somone is shouting
0 someone is shouting laud

while i have now
-160 silence
0 somone is talking

can i make something similar?
Quote this message in a reply
Moderator
Posts: 453
Joined: 2008.04
Post: #4
I guess you might want to compare peakPowerForChannel and averagePowerForChannel. See if talking and shouting return the same values for the average power. Perhaps while talking, there's a very tiny peak that goes up to 0.

Howling Moon Software - CrayonBall for Mac and iPhone, Contract Game Dev Work
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #5
tried but doesn't work...
averagePowerForChannel if i record my voice and then i go up with my voice volume, it goes avarege volume goes up a bit, because i was silent for more time...
is there a way to change audio level controls for mic?
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #6
can i change the mic volume to have an input lower than it is in reality?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  AVAudioPlayer: AddRunningClient starting device on non-zero client count sefiroths 2 6,151 Dec 20, 2010 04:17 AM
Last Post: sefiroths