wiki:SV8Specification

Version 8 (modified by zorg, 18 years ago) (diff)

--

SV8 specification draft

Nota : All fields, unless explicitely specified otherwise are read and written in Big-Endian order, independently of the underlying architecture.

File magic number

Magic number is on 32bits and is equal to 'MPCK' or 0x4D50434B
New value so old decoders will happily skip such files.

Block formatting

All blocks are formated using Key / Length / Value.
Key is 16 bits long. It's the block ID.
Variable block length encoding (NUT way) :

bits, big-endian
0xxx xxxx                                           - value 0 to  2^7-2
1xxx xxxx  0xxx xxxx                                - value 0 to 2^14-2
1xxx xxxx  1xxx xxxx  0xxx xxxx                     - value 0 to 2^21-2
1xxx xxxx  1xxx xxxx  1xxx xxxx  0xxx xxxx          - value 0 to 2^28-2
...

The length is the size of the block in bytes, including the key and size fields. So the minimum length of a block is 3 bytes.
The value is the block content. Its size can be 0.
All unused bits in a block MUST be 0.

Field length (bits) Value
Key 16 "EX"
Length n*8; 0 < n < 10 0x1A
Value Length * 8 "example"

Stream information block

This block key is "SI".
This block contain the informations needed to decode the stream. This block is mandatory and must be written before the first audio block.

Field length (bits) Value comment
CRC 32 CRC 32 of the block (this field excluded). 0 = invalid
Sample count n*8; 0 < n < 10 number of samples in the stream. 0 = unknow
Sample Frequency 4 see table below
Channel count 4 1..16 number of channels in the stream
Audio block frames 4 1..16 number of frames in an audio block is : 2Value (2..65536)
Unused 4 must be 0
Max used bands 5 1..32 maximum number of bands used in the file
IS used 1 IntensityStereo. Klemm specification suggest to use the number of band always using IS ?
MS used 1 MidSideStereo
PNS used 1

Frequency table

Value Frequency (Hz)
0 44100
1 48000
2 37800
3 32000
4 96000

The CRC used in this block needs to be define.

Replay gain block

This block key is "RG".
This block contains replay gain datas. This block is mandatory and must be written before the first audio block.
Values stored in dB in Q8.8 format (maybe Q7.9 or relative to the max value for the bitdepth is better ?).

Field length (bits) Value comment
Version 8 The replay gain version
Title gain 16 The loudness calculated for the title, and not the gain that the player must apply
Title peak 16
Album gain 16 The loudness calculated for the album
Album peak 16

Encoder infomations

This block key is "EI".

Field length (bits) Value comment
profile used 4 0..15
unused 4
encoder version 24 0-255.0-255.a-z

( 32 bits for encoder version like MajorNumber.MinorNumber.Implementation.Build ? )

Audio block

This block key is "AB".
This block contain audio frames. The first frame is a key frame.

The seek elements allow to jump back or forward. The block size can be used to seek 1 block forward.
Allow to seek back and forward in O(ln(n)) time without a seeking table. Have to find something like this paper

Field length (bits) Value comment
seek block nb 4 2..17 the number of blocks that can be skiped is 2Value
seek offset 28 -227..227-1 number of bytes to jump the blocks from the beginning of this block. 0 = invalid
audio frames ?

Seek Table Block

This block key is "ST".

Format have to be defined.

Security Block

Checksum (MD5, SHA1) or error correcting code (LDPC).
To be defined later. May be better to keep security features external only.

Tags

No block must be written after the last audio block to allow tagging by other applications.
Remarks about tagging? Incompatibilities?

Attachments (3)

Download all attachments as: .zip