8

I want to measure sound in dB(A) in iPhone.

How can I do it?

Is there any example or tutorial?

Monolo
  • 18,205
  • 17
  • 69
  • 103
Mitul Nakum
  • 5,514
  • 5
  • 35
  • 41

1 Answers1

1

If you use AVAudioPlayer, you can use this method

AVAudioPlayer *avPlayer = ...
[avPlayer play...];
[avPlayer averagePowerForChannel:0];
[avPlayer averagePowerForChannel:1];

From Apple's doc

- (float)averagePowerForChannel:(NSUInteger)channelNumber

Description
Returns the average power for a given channel, in decibels, for the sound being played.

Community
  • 1
  • 1
tuoxie007
  • 1,234
  • 12
  • 10
  • 1
    Yes, but "average power ... in decibels" is surely giving you the [power in dB relative to full scale (dBFS)](http://en.wikipedia.org/wiki/DBFS) not [dBA(http://en.wikipedia.org/wiki/A-weighting). I think you need a proper, calibrated SPL meter to get a dBA measurement. – j b May 30 '13 at 10:25
  • This is dBFS and not DB(A). – Nicolas Lauquin Feb 05 '14 at 14:46