Does anyone know what is the returned unit of the method:
MediaRecorder.getMaxAmplitude();
The Android MediaRecorder API documentation indicates only that this method returns the maximum absolute amplitude of the sampled points since the last call but does not specify the unit. Is it in pascal, milli-pascal, other?
After some detailed search myself and some colleges have came to this conclusion. The yet answers to this questions were not complete to my knowledge therefore, I am writing own answer to this question.
The MediaRecorder.getMaxAmplitude() function returns unsigned 16-bit integer values (0-32767). Those values are probably calculated by using abs() on -32768 … +32767, similar to the normal CD-quality sample values. Negative amplitudes are just mirrored and therefore the amplitude is always positive.
The values are NOT RELATED to any concrete calibrated physical property. The values are therefore, just 16-bit digitalisation of electrical output from 0-100% (maximum voltage range of that microphone).
Microphones convert sound pressure (Pascal) linearly to voltage. Therefore, values reported by the api correlate with sound pressure BUT they are different on each device used and depends heavily on brand, model, and specific device (circuits, amplifier, etc.) This means that it is extremely hard to judge the values without calibrating the phone microphone to a reliable sound pressure meter.
The MediaRecorder.getMaxAmplitude()
values range between 0 and 32,767
(Note: 32,767 is the maximum value of a signed integer)
The units are not standard.
In my apps, I generally treat any value greater than 18000 as "loud", which is about 50% of the maximum value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With