Android AMR speech codec solution [go to http://blog.csdn.net/xyz_lmn/article/category/922246]

Source: Internet
Author: User

Android AMR speech codec Solution Androidandroidarmarm sound collection today, I have made a good research on Android speech compression encoding. I have some tips:

first, the format of the collected audio source is the PCM-16bit format, what is the PCM format, let's take a look at the following Article :

http://blog.csdn.net/tkboy/archive/2009/12/19/5038947.aspx

PCM is a sound source without compression, PCM signals are digital signals composed of [1], [0], and other symbols. Android devices adopt the sound source format, which we compress and encode.

I did not write the encoding library myself, but extracted it from bambuser. The test showed that this library is really powerful and powerful, so powerful that it can be reused, the encoding is as follows:

Read = maudiorecorder. read (arrayofbyte1, 0,320);
encodelength = mamrencoder. encode (arrayofbyte1, 0, read, arrayofbyte2, amrencoder. mr475);

why is it 320?

I asked a friend who is a sip expert to say this:

package every 320 bytes or a multiple of these bytes

This is probably the reason, however, I still don't quite understand this, and our technical director said this:

traditionally, the unit of voice frames is 20 m, the data size for every 20 ms is 320 bytes. Of course, this is 16 bit, 8 kHz.

how to calculate it.

well, I 'd like to explain the encoding situation to you and deepen your understanding of this aspect:

after the 320-byte PCM-16 speech is encoded, the programming length is 13 bytes, that is, the AMR Nb speech format, if we want to use audiotrack to play the video, we need to use amrdecoder to decode the 13 bytes and restore them to 320-byte PCM for playing.

at present, the efficiency of AMR is relatively high, and the compression ratio is: 320: 13,320 bytes compressed to 13 bytes

GSM can also be considered as follows: 320: 33,320 bytes to compress into 33 bytes

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.