Decibels in android

这一生的挚爱 提交于 2019-12-01 01:40:56

The decibel scale is always a measure relative to something - and in the case of digital audio, that something is customarily the largest value that a sample is capable of holding. This is either 1.0 for floating point representations of samples and 32767 for signed 16-bit samples. Calculated dB values are negative, with 0dB being clip.

Without knowledge of what precisely what recorder is an instance of, I will assume it's Android's MediaRecorder - which uses signed 16-bit ints.

The correct equation in this case would therefore be:

db = 20.0 * log10(peakAmplitude/32767.0)

The equation you've used above however, merely biases the results as it's eqivelant to:

db = 20.0 * log10(peakAmplitude) - 20.0 * log10(700)

=20.0*log10(peakAmplitude) - ~56.9

The dynamic range figure of 30dB might not be surprising if you're recording the onboard microphone and automatic gain control is enabled - as it will be unless you've taken active steps to disable it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!