Bashar Altakrouri
Bashar Altakrouri

Reputation: 10615

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?

Upvotes: 6

Views: 2535

Answers (3)

Bashar Altakrouri
Bashar Altakrouri

Reputation: 10615

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.

Upvotes: 7

gregm
gregm

Reputation: 12179

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.

Upvotes: 3

hotpaw2
hotpaw2

Reputation: 70743

The units of measurement will be different for every different device or microphone. If you want to know, you will have to test each particular microphone model against a calibrated source or measurement instrument.

Upvotes: 0

Related Questions