Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the unit of the returned amplitude of getMaxAmplitude method?

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?

like image 856
Future2020 Avatar asked May 19 '12 20:05

Future2020


2 Answers

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.

like image 173
Future2020 Avatar answered Oct 02 '22 14:10

Future2020


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.

like image 38
gregm Avatar answered Oct 02 '22 12:10

gregm