Android Recording Getmaxamplitude ()

Source: Internet
Author: User

This method is used to obtain the maximum amplitude that appears in the recording after the previous call to this method, and the document is interpreted as follows:

Returns the maximum absolute amplitude that is sampled since the last call to this method. This is only after the Setaudiosource ().

Many people encounter problems, saying that the return value is 0, as explained in the document: the maximum absolute amplitude measured since the last call, or 0 when called for the first ti Me

So this method needs to be called at intervals of time, that is, it needs to be placed inside the thread. The first call returns 0.

Recently, we need to use this method to get the change of volume, curious about its return value, looked up some information (from StackOverflow), explained as follows:

The Mediarecorder.getmaxamplitude () function returns unsigned --bit integer VALUES (0-32767). which isProbably just the ABS () of the Cd-quality sample values that range from-32768To32767. This means, they probably represent a --bit digitalization of the electrical output from 0- -% maximum voltage range of the microphone build into that mobile phone. Since eveninchOne brand of mobile these microphones sometimes varyinchTheir precise range not even to similar phones would necessarilyreturnThe same value given the same distance to the same sound source. This value however correlates to the sound pressureinchPascal since it's also a linear quantisation of the solund pressure, in the area where sound can is measured with the given microphone (which won't cover the entire sprectrum due to the limitations of the phone).

And then look at the source of Millet recorder, it has a piece of code is used to reflect the recording volume, the key code is as follows:

int 32768;

Where Max_vu_size is the number of levels the millet will score, then the amplitude can be obtained by 32768 (about this number, as explained in the previous section of the data), this way you can get the level of the volume.

Android Recording Getmaxamplitude ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.