0

I'm trying to build a dB Measurement to unlock a feature within an app. The Feature should become available once the user reaches 100dB. My current implementation is only able to measure up to 96dB. From what I understand the Problem is somehow related to the bitrate recording: 16bit are only capable of 96dB, 24bit should be capable of 144dB (http://www.head-fi.org/t/415361/24bit-vs-16bit-the-myth-exploded).

The dB Measurement and Calculations work fine, my only issue is that I can not measure more than 96dB. I'm struggeling with the settings to achieve a higher bit rate, I guess I'm doing something wrong here.

My current initialisation of the recorder looks like this:

NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
                      [NSNumber numberWithFloat: 44100.0],                 AVSampleRateKey,
                      [NSNumber numberWithInt: kAudioFormatAppleIMA4],       AVFormatIDKey,
                      [NSNumber numberWithInt: 1],                         AVNumberOfChannelsKey,
                      //[NSNumber numberWithInt: 24],                         AVEncoderBitRateKey,
                      [NSNumber numberWithInt:24],AVLinearPCMBitDepthKey,
                      [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,
                      [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,
                      [NSNumber numberWithInt: AVAudioQualityMax],         AVEncoderAudioQualityKey,
                      nil];

NSError *error;

recorder = [[AVAudioRecorder alloc] initWithURL:outputFileURL settings:settings error:&error];

Thank you in advance.

1 Answers1

0

It's important to understand that a dB value is just an expression of a ratio, not an absolute value. In this case it's the magnitude of the signal relative to the smallest value, so for a 16 bit signed value you have 20 * log10(2^16) = 96 dB. In other words the loudest signal is 96 dB louder than the smallest signal. With 24 bit data the range is much bigger: 20 * log10(2^24) = 144 dB. However the full scale signal is still the same value. (Note that more commonly we use full scale as a reference of 0 dB, and express all other values as negative dB values, but the reference is completely arbitrary).

A common source of confusion is that when people talk about how loud sound is, they say "dB" but what they are actually referring to is dB SPL, which is way of defining loudness relative to a given reference value (20 µPa (rms)). Do not confuse this with the dB values you are calculating above, which are simple ratios, and are not directly related to loudness.

Paul R
  • 208,748
  • 37
  • 389
  • 560
  • Thank you, understood. As I mentioned my formulas work great but the averagePowerForChannel Value is something between 0 and -160. My Problem is currently that I reach the 0 (loudest) value at around 96dB (compared to other decibel measurement apps). Did you manage to change your input signal to 24bit somehow? (Or do I not need to? The settings in my initial post doesn't look like to show any affect on the data range) – Florian Bergmann Mar 25 '14 at 09:00
  • I think you're still not getting the point about `dB` being a *ratio*, and hence *arbitrary*. Those "other apps" are not reporting `dB SPL` - they are just returning a `dB` value relative to some arbitrary reference. You can add or subtract any `dB` offset you like to make your values match and the numbers will be just as valid. If your problem is *range* though, then note anything more than about 96 dB on a consumer device is a joke - you can perhaps set audio resolution to 24 bits but the noise floor will prevent you getting any greater range than you see at 16 bits. – Paul R Mar 25 '14 at 09:06