Data Sheet
PRELIMINARY
VS1063a Datasheet
10 OPERATION
10.7.4 File Headers
VS1063 automatically creates a suitable header for the selected encoding mode. If you have
selected MP3 or Ogg Vorbis, the headers will be in those formats, otherwise you get a RIFF
WAV header with the correct samplerate, number of channels, and other information. (If you
have set bit 10 of SCI_AICTRL3, the RIFF WAV header is not generated.) When you finish
encoding you have to fix the RIFF size and data size fields.
The following shows a header for a 8 kHz mono µ-law WAV file. Note that 2- and 4-byte values
are little-endian (least significant byte first).
VS1063a RIFF WAV Header
File Offset Field Name Size Bytes Description
0 ChunkID 4 RIFF ident
4 ChunkSize 4 F0 F1 F2 F3 File size - 8
8 Format 4 WAVE ident
12 SubChunk1ID 4 fmt ident
16 SubChunk1Size 4 0x14 0x0 0x0 0x0 20
20 AudioFormat 2 0x07 0x0 Audio format
22 NumOfChannels 2 0x01 0x00 1 for mono, 2 for stereo
24 SampleRate 4 0x40 0x1f 0x00 0x00 0x1f40 = 8000 Hz
28 ByteRate 4 0x40 0x1f 0x00 0x00 Bytes per second
32 BlockAlign 2 0x01 0x00 1 byte per block
34 BitsPerSample 2 0x08 0x00 8 bits / sample
36 Extra size 2 0x02 0x00 2 extra bytes
38 Samples per block 2 0x01 0x00 1 sample per block
40 SubChunk3ID 4 Data ident
44 SubChunk3Size 4 D0 D1 D2 D3 Data size (File Size-48)
48 Samples. . . data
Because VS1063a cannot know in advance how long the recording will be, it will set both RIFF
ChunkSize and Data SubChunk3Size fields F and D to 0xFFFFFFFF. You have to fill in correct
values for F and D after finishing encoding.
Below is an example of a valid header for a 44.1 kHz mono PCM file that has a final length of
1798772 (0x1B7274) bytes:
Version: 0.42, 2011-11-24 59