I'm trying to implement a sound meter in dB in android but I haven't found the way to start yet. I have gone over androids API and haven't found anything that I think is suitable. Can anyone help me please?
Asked
Active
Viewed 3,962 times
2 Answers
3
This isn't possible in general because of the confusion between the different meanings of 'dB' and the fact that you can't measure physical Sound Pressure Level (which is generally what people mean when they talk about 'sound meters') without calibrated devices. See my previous answers to similar questions:

Community
- 1
- 1

the_mandrill
- 29,792
- 6
- 64
- 93
-
Same problem with having colorimeter apps. If it's not calibrated it's not useful. – Mike dg Feb 18 '13 at 13:40
2
Try using AudioRecord to record the audio to a buffer, then measure the dB's from the raw PCM data.
To initialize AudioRecord
AudioRecord record = new AudioRecord(AudioSource.MIC, SAMPLING_RATE, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufferSize);
To read a sample from MIC
short[] buff = new short[8000];
record.read(buff, 0, buff.length);

DMK
- 2,448
- 1
- 24
- 35
-
This can be used to calculate a dB power level scale that represents the amplitude of the digital signal, which will have a maximum level of 0dB, but it won't help if you need a Sound Pressure Level value (eg where 120dB(SPL) = volume of a rock concert) – the_mandrill Feb 18 '13 at 13:40