VOC Format

From ModdingWiki
Jump to: navigation, search
Edge of map!

The Creative Voice File (.VOC) consists of a main header, followed by one or more data blocks. The file is in little Endian format.

Contents

Main header

Bytes Value
0-18 "Creative Voice File"
19 0x1A
20-21 Size of the main header. Usually 0x1A 0x00
22-23 Version number. Usually 0x0A 0x01 (Old format) or 0x14 0x01 (New format)
24-25 "Checksum". This should equal version + 0x1234

Data blocks

All data blocks have a common header:

Bytes Value
0 Block type
1-3 Block size, excluding the header

There are 10 different block types:

0: Terminator

This special block does not contain a size in the header. It is used to indicate the end of the file, though the file can end without it.

1: Sound data

Bytes Value
0 Frequency divisor
1 Codec #, see below
2-n Audio data

The sample rate of the file can be determined by:

Sample rate = 1000000/(256 - frequency divisor)

The codec can be one of the following:

Codec # Name
8 bits unsigned PCM
0x01 4 bits to 8 bits Creative ADPCM
0x02 3 bits to 8 bits Creative ADPCM (AKA 2.6 bits)
0x03 2 bits to 8 bits Creative ADPCM
0x04 16 bits signed PCM
0x06 alaw
0x07 ulaw
0x0200 4 bits to 16 bits Creative ADPCM. Only valid in block type 9

2: Sound data (2)

Bytes Value
2-n Audio data

This block uses the same codec as block type 1.

3: Silence

Bytes Value
0-1 Length of silence - 1
2-n Frequency divisor (see block type 1)

4: Marker

Bytes Value
0-1 Mark value

Apparently, this can be used to synchronize the sound file with an external animation.

5: Text

Bytes Value
0-n Text string, zero terminated

6: Repeat start

7: Repeat end

8: Extra information

9: Sound data (New format)

Source

This page was adapted from MultimediaWiki

Personal tools
programming