For a project work, I need to measure the volume level either from a recorded audio file or in real time recording using a mic. After my primary research, I have tried using soundfile library. The file was read using soundfile and using 20*np.log10(np.sqrt(np.mean(np.absolute(a)**2))), I have calculated the dB value. I'm getting a negative value for the sound file. But a normal sound may be in the range of 50-70 dB and I'm getting a negative value. Can anybody help me to sort out this?
You need to add reference of sound i.e 20 log10(P rms_value/P ref)+120 dB to get the data in the range of dB scale, Pref can be tuned from your input module
Python: Get volume decibel Level real time or from a wav file