Sound meter

I am trying to embed a sound meter in dB in android, but I have not yet found a way to start. I switched the android API and did not find anything suitable. Can anybody help me?

+3
android audio
source share
2 answers

Try using AudioRecord to record audio into the buffer, then measure dB from 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); 
+2
source share

This is not possible in general because of the confusion between the various β€œdB” values ​​and the fact that you cannot measure the physical level of sound pressure (which people usually mean when talking about β€œsound meters”) without calibrated devices. See my previous answers to similar questions:

  • Audio output level in a form that can be converted to decibels
  • Calculate A-weighted (or B or C) iOS SPL decibel
+2
source share

All Articles