| 34 | |
| 35 | |
| 36 | == Stream information block == |
| 37 | |
| 38 | This block key is "SI".[[BR]] |
| 39 | This block contain the informations needed to decode the stream. This block is mandatory and must be written before the first audio block.[[BR]] |
| 40 | |
| 41 | || '''Field''' || '''length (bits)''' || '''Value''' || '''comment''' || |
| 42 | || CRC || 32 || || CRC 32 of the block (this field excluded). 0 = invalid || |
| 43 | || Sample count || n*8; 0 < n < 9 || || number of samples in the stream. 0 = unknow || |
| 44 | || Max used bands || 4 || || maximum number of bands used in the file || |
| 45 | || Sample Frequency || 4 || || see table below || |
| 46 | || Channel count || 4 || || number of channels in the stream || |
| 47 | || Audio block frames || 4 || 1..16 || number of frames in an audio block is : 2^Value || |
| 48 | || IS used || 1 || || Klemm specification suggest to use the number of band always using IS ? || |
| 49 | || MS used || 1 || || || |
| 50 | || True gapless || 1 || || always 1 ? || |
| 51 | || PNS used || 1 || || || |
| 52 | || unused || 4 || || must be 0 || |
| 53 | |
| 54 | Frequency table |
| 55 | || '''Value''' || '''Frequency (Hz)''' || |
| 56 | || 0 || 44100 || |
| 57 | || 1 || 48000 || |
| 58 | || 2 || 37800 || |
| 59 | || 3 || 32000 || |
| 60 | || 4 || 96000 || |
| 61 | |
| 62 | The CRC used in this block needs to be define. |
| 63 | |
| 64 | |
| 65 | == Replay gain block == |
| 66 | |
| 67 | This block key is "RG".[[BR]] |
| 68 | This block contains replay gain datas. If this block exists, it must be written before the first audio block.[[BR]] |
| 69 | A log scale must be used to store the values.[[BR]] |
| 70 | |
| 71 | || '''Field''' || '''length (bits)''' || '''Value''' || '''comment''' || |
| 72 | || Title gain || 16 || || The loudness calculated for the title, ''and not the gain that the player must apply'' || |
| 73 | || Title peak || 16 || || || |
| 74 | || Album gain || 16 || || The loudness calculated for the album || |
| 75 | || Album peak || 16 || || || |
| 76 | || Version || 8 || || The replay gain version || |
| 77 | |
| 78 | |
| 79 | == Encoder infomations == |
| 80 | |
| 81 | This block key is "EI". |
| 82 | |
| 83 | || '''Field''' || '''length (bits)''' || '''Value''' || '''comment''' || |
| 84 | || profile used || 4 || 0..15 || || |
| 85 | || unused || 4 || || || |
| 86 | || encoder version || 8 || || || |
| 87 | |
| 88 | {{{ |
| 89 | Encoder version * 100 (106 = 1.06) |
| 90 | EncoderVersion % 10 == 0 Release (1.0) |
| 91 | EncoderVersion % 2 == 0 Beta (1.06) |
| 92 | EncoderVersion % 2 == 1 Alpha (1.05a...z) |
| 93 | }}} |
| 94 | |
| 95 | == Audio block == |
| 96 | |
| 97 | This block key is "AB".[[BR]] |
| 98 | This block contain audio frames. The first frame is a key frame.[[BR]] |
| 99 | The seek elements allow to jump back or forward. The block size can be used to seek 1 block forward.[[BR]] |
| 100 | |
| 101 | Seek block nb should be ( - means offset is negative) :[[BR]] |
| 102 | 2 -2 3 -3 2 -2 4 -4 2 -2 3 -3 2 -2 5 -5 2 -2 3 -3 2 -2 4 -4 2 -2 3 -3 6 -6 2 -2 ...[[BR]] |
| 103 | so 2 -> 2, 3 -> 3 ... and -2 -> -2, -3 -> -3 ...[[BR]] |
| 104 | Allow to seek back and forward in O(ln(n)) time without a seeking table.[[BR]] |
| 105 | |
| 106 | || '''Field''' || '''length (bits)''' || '''Value''' || '''comment''' || |
| 107 | || seek block nb || 4 || 2..17 || the number of blocks that can be skiped is 2^Value || |
| 108 | || seek offset || 28 || -2^27..2^27-1 || number of bytes to jump the blocks from the beginning of this block. 0 = invalid || |
| 109 | || audio frames || ? || || || |
| 110 | |
| 111 | |