Android Audio Recorder's **getMaxAmplitude()** returns different values on different devices

StackOverflow https://stackoverflow.com/questions/20564354

  •  01-09-2022
  •  | 
  •  

I have used Android's audio recorder for my application to calculate the surrounding noise.

I got the maximum amplitude with the getMaxAmplitude() function and converted it to db using this formula :

db = 20 * Math.log10( getMaxAmplitude() / ref )

where ref=32767 (just a reference value)

But when I test the application in different devices the "db" is not the same.Which means the getMaxAmplitude() varies among devices.

If in sony tipo it shows -40db means in Samsung S4 its -20db.

Why this variation?

有帮助吗?

解决方案

Different devices will have different microphones, with different sensitivities, and different audio hardware / preamps. Additionally, they may apply different input gain, EQ, and also automatic gain control (AGC) and noise reduction algorithms which may explain the big difference you are seeing.

On some devices you may be able to run AlsaMixer (as root) to control the microphone input gain.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top