SPH0645 decibels

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
DGS31
 
Posts: 1
Joined: Tue Oct 16, 2018 9:42 am

SPH0645 decibels

Post by DGS31 »

Hello,

I need to get the decibels for the SPH0645 on a raspberry pi

I have followed the steps from https://learn.adafruit.com/adafruit-i2s ... g-and-test .
I am able to record and playback the sound files, but i have problem getting the decibels from it.

In the code i have 2 arrays whitch i use to calculate the DB:
One using numpy to create the array and audioop to calculate db
unpackedArray = np.frombuffer(data, dtype=dataType)
dbUnpacked = 20*np.log10(audioop.rms(unpackedArray,2))

And the other one i do manual operations: processArray

Both calculations give me about the same resuts.

The code gives me values between 82 and 83 when using the SPH0645
Using the same code on windows or on rasperry with a USB mic gives me proper DB (40-80)



Here is the code: https://BANNED.com/4XCMt4TD


Any help pointing me to the right direction would be highly appreciated.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: SPH0645 decibels

Post by adafruit_support_mike »

Decibels measure ratios, not absolute values.

To convert the SPH0645's ADC output to sound pressure levels, you have to normalize them. Find the RMS voltage of a signal at some reference volume, then divide all the other readings by that. The result will be the ratio between the input and the reference, which you can express in decibels. Then you can add that decibel value to the decibel value of the reference sound on a standard SPL chart to get SPL for the input.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”