Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting decibel from an Android microphone

I have been searching for quite some time now, and I haven't been able to find a way to actually get an SPL/db value from a microphone on Android.

The few threads and articles that I have found that discussed it treated it like something so obvious that anyone should be able to do it, and were more concerned with getting their conversion algorithms correct.

Does anyone know how to do this?

like image 412
Brandon Avatar asked Nov 24 '10 22:11

Brandon


1 Answers

While working on other related apps, and doing research, I have come across some information that would be useful to anyone who is looking into something such as this.

You see, the microphone on an Android phone will return a value between 0 and +- 32,400. For the most part, anything over 2,000 is really loud, such as a concert, club, or mechanical noise. "Relative Silence" is around 30. However, these values' meanings are relative, and will differ from phone to phone. Several devices sitting right next to each other will return different values, because of the microphones in them. The values can differ a little, or a lot.

Just testing several different android powered phones in my office, I have found that some devices would return values 10× that of other devices in the same situation. This is why there hasn't been anyone who has just said "Yeah, you can get the decibel value, here's some sample code:" because there is NOT really a reliable (and easy) way TO do it, realistically.

If you uploaded it on one device, you could get, say, 30 dB, but another would return 300dB. Clearly, no human would be in an evironment with 300 dB without massive ear protection. The values have to be taken as relative values; how they relate to each other. "Calibration", whether dynamic or otherwise, is a must if you want to get values that you can use. There has to be an established baseline, that cannot come from you, which has to be compared to a value from you. For example, relative silence, as stated before, should be around 30.

If the phone returns 456 in a relative silence environment, then simply divide yours (30) by theirs (456), and you have a factor that will serve as adjusting the values returned by the phone so that they match what you are expecting to see, and those values can be used for some degree of reliability.

This is just what I have found over the past few months, I hope it helps someone.

like image 140
Brandon Avatar answered Oct 03 '22 13:10

Brandon