AMR Audio file Format analysis
1 Overviewtoday, many smartphones support multimedia features, especially audio and video playback, and the AMR file format is an audio file format commonly supported on mobile phones. Amr, the full name is: Adaptive multi-rate, Adaptive multi-rate, is an audio encoded file format designed to effectively compress speech frequencies.
AMR Audio is mainly used for mobile device audio compression, compression ratio is very high, but the sound quality is poor, mainly used for audio compression of speech class, not suitable for the sound quality requirements of the music class audio compression.
2 AMR Encoding methodAMR has a common 16 encoding methods. 0-7 the corresponding 8 different encoding methods, each encoding method of sampling frequency is different ; 8-15 is used for noise or retention.
Description
- Bit rate refers to the digital sound from the analog format into a digital format of the sample rate, the higher the sample rate, the better the sound quality after restoration.
- Bit rate vs. Real Audio:
- 16kbps= Telephone Quality
- 24kbps= Add telephone quality, shortwave radio, long wave Broadcasting, medium wave broadcast in European format
- 40kbps= American Standard medium wave Broadcast
- 56kbps= Voice
- 64kbps= add voice (mobile ringtone Best bit rate setpoint, phone mono MP3 player Best Set Value)
- 112KBPS=FM FM Stereo Broadcast
- 128kbps= tape (best setpoint for cell phone stereo MP3 player, low-end MP3 player optimal setting value)
- 160kbps=hifi High Fidelity (best set value for middle-grade MP3 player)
- 192KBPS=CD (best set value for high-end MP3 player)
- 256kbps=studio Music Studio (for music enthusiasts)
- Audio data frame size calculation: AMR frame corresponding 20ms, then a second has 50 frames of audio data. The data size of each frame is different because of the bit rate. Suppose the bit rate is 12.2kbs. The number of audio data samples per second is: 12200/50 = 244bit = 30.5byte, Rounding is 31 bytes. Rounding is rounded, plus one byte of the frame header, so that the size of the data frame is 32 bytes.
3 AMR file structure Model diagram
Below we look at an actual AMR file (http://download.csdn.net/detail/ce123/6701049):
It can be seen that all AMR file header flags are 6 bytes (the last byte is the newline character "/n"). The frame head is 0x2c, followed by an audio frame. This file is 21 bytes per frame.
4 AMR Frame header format AnalysisAMR Voice frame format is composed of frame header and voice data.
AMR Voice Frame Header occupies 1 bytes, for example as seen in:
Of
P = 0;
Ft:frame Type, corresponding to different encoding modes. (See the "2 AMR encoding Method" For instructions in the table)
Q: Frame quality indicator, 0 indicates bad frame.
The p in the back is 0.
5 amr frame reading algorithmDue to the possibility of abnormal frames, it is not necessarily all the same size of the voice frame, for the normal frame size inconsistent, or the frame head with the normal frame header is inconsistent, do not give the decoder, directly discard the bad frame. The following is a flowchart of algorithmic descriptive narratives.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy2uxmjnfemhvdxdlaq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast "/>
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
AMR Audio file Format analysis