All bits are set to 1. It is used for finding the beginning of frame. But these values can occur many times in binary file so you should test next values from header for validity (eg. bitrate bits arent 1111, sampling rate frequency isnt 11 etc.). But you can never be 100% sure if you find a header.
Next method is to find the first header and then go through all frames - almost exact, but time consuming.
Be careful with the first frame! It doesnt have to start at the first Byte in file. Either TAG v2 can be included or file can contains of some crap at the beginning.
Anyway - to find a header is a little problem.
MPEG version ID|
But almost all MP3 files doesnt contain CRC.
Samplig rate frequency index|
Note: Sample frequency 44100 means that one second of audio information is hacked to 44100 pieces. And each 1/44100 sec. is audio value taken and encoded into digital form.
It can be freely used for specific needs of an application, eg. it can execute some application specific events.
No special meaning, forget it.
Mode extension (only if Joint Stereo is set)|
|0-3||Standard audio frame header (as descripted above). Mostly it contains values
FF FB 30 4C, from which you can count FrameLen = 156 Bytes. And thats exactly enough space for storing
This header contains some important information valid for the whole file:
- MPEG (MPEG1 or MPEG2)
- SAMPLING rate frequency index
- CHANNEL (JointStereo etc.)
|4-x||Not used till string "Xing" (58 69 6E 67). This string is used as a main VBR file identifier. If it is not found, file is supposed to be CBR. This string can be placed at different locations according to values of MPEG and CHANNEL (ya, these from a few lines upwards):|
|36-39||"Xing" for MPEG1 and CHANNEL != mono (mostly used)|
|21-24||"Xing" for MPEG1 and CHANNEL == mono|
|21-24||"Xing" for MPEG2 and CHANNEL != mono|
|13-16||"Xing" for MPEG2 and CHANNEL == mono|
|After "Xing" string there are placed flags, number of frames
in file and a size of file in Bytes. Each of these items has 4 Bytes and it is stored as
'int' number in memory. The first is the most significant Byte and the last is the least.|
Following schema is for MPEG1 and CHANNEL != mono:
Number of frames in file (including the first info one)
File length in Bytes
|52-151||TOC (Table of Contents)|
Contains of 100 indexes (one Byte length) for easier lookup in file. Approximately solves problem with moving inside file.
Each Byte has a value according this formula:
(TOC[i] / 256) * fileLenInBytes
So if song lasts eg. 240 sec. and you want to jump to 60. sec. (and file is 5 000 000 Bytes length) you can use:
TOC[(60/240)*100] = TOC
and corresponding Byte in file is then approximately at:
(TOC/256) * 5000000
If you want to trim VBR file you should also reconstruct Frames, Bytes and TOC properly.
I dont know exactly system of storing of this values but this item probably doesnt have deeper meaning.
|0-2||3||Tag identifier. Must contain "TAG" string if Tag is valid.|
|0-2||TAG identifier. It contains of string "ID3"|
|3-4||TAG version. Can be eg. 03 00|
|6-9||Size of TAG|
|a||TAG alter preservation|
|b||File alter preservation|