Analysis of AMR audio file formats
1 Overview currently, many smart phones support multimedia functions, especially audio and video playback functions. The AMR file format is generally supported by mobile phones. AMR is short for Adaptive Multi-Rate and Adaptive Multi-Rate. It is an audio encoding file format dedicated to effectively compressing the voice frequency.
2 AMR encoding method AMR has a total of 16 encoding methods. 0-7 corresponds to 8 different encoding methods, with different sampling frequencies for each encoding method. 8-15 is used for noise or retention.
Note:
Bit Rate refers to the sampling rate for converting a digital sound from a analog format to a digital format. The higher the sampling rate, the better the restored audio quality. comparison of bit rate value with actual audio: 16 kbps = 24 kbps of telephone sound quality = increased telephone sound quality, short-wave broadcast, long-wave broadcast, european Standard medium wave broadcast 40 kbps = u. S. Standard medium wave broadcast 56 kbps = Voice 64 kbps = increased voice (the best bit rate setting value for cell phone ringtones, the best setting value for mobile phone single channel MP3 players) 112 kbps = FMFM stereo broadcast 128 kbps = tape (the best value for mobile phone stereo MP3 players and the best value for low-end MP3 players) 160 kbps = HIFI (the best value for medium and high-end MP3 players) 192 kbps = CD (the best value for high-end MP3 players) 256 kbps = computing of the audio data frame size of Studio music Studio (applicable to music enthusiasts): amr corresponds to 20 ms for one frame, so there are 50 frames of audio data in one second. the data size of each frame varies depending on the bit rate. if the bit rate is 12.2kbs. the number of audio data sampled per second is 12200/50 = 244bit = 30.5 bytes, And the integer is 31 bytes. rounding is required, and the frame header of the last byte is added. In this way, the data frame size is 32 bytes.
3. Demo diagram of AMR file structure
Next let's look at an actual AMR file (http://download.csdn.net/detail/ce123/6701049): 4 AMR frame Header Format analysis AMR voice frame format is composed of frame header and voice data. the 5 AMR frame reading algorithm may have abnormal frames, so not all voice frames are of the same size, or if the frame header is inconsistent with the normal frame header, the frame will not be handed over to the decoder and the bad frame will be discarded directly. the following is a flowchart of algorithm description.