Today I have made a good research on the speech compression encoding in Android, and I have some tips:
First of all on the collection of sound source format is the PCM-16bit format, What Is PCM format, you can see the following article:
Http://blog.csdn.net/tkboy/archive/2009/12/19/5038947.aspx
PCM is a non-compressed sound source. PCM signals are digital signals composed of [1], [0], and other symbols. This format is used by Android devices, we also perform compression encoding for this format.
I did not write the encoding library by myself. It was extracted from bambuser. The test showed that this library is really fucking powerful and powerful, each encoding is like this:
Read = maudiorecorder. Read (arrayofbyte1. 0,320 );
Encodelength = mamrencoder. encode (arrayofbyte1, 0, read, arrayofbyte2, amrencoder. mr475 );
Why 320?
I asked a friend who is a sip expert to say this:
Package every 320 bytes or a multiple of these bytes.
Maybe this is the reason, but I still don't quite understand it. Then our technical director said this:
Traditionally, the voice frame is measured in ms. The minimum unit of the voice frame 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.
Okay. Let's talk about the encoding 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 voice format of AMR Nb. If we want to play it through audiotrack, we have to use amrdecoder to decode and restore these 13 bytes to 320-byte PCM for playback.
At present, the efficiency of AMR is relatively high. The compression ratio is: 320: 13,320 bytes to 13 bytes.
You can also consider GSM: 320: 33,320 bytes to compress to 33 bytes.
/**
* @ Author Zhang xingye
* Email: xy-Zhang # 163.com
* Android Development Group: 278401545
*
*/