A VOC file is a header followed by a list of typed blocks. Every number is
little-endian. The page follows Creative’s own description, appendix B of the
Sound Blaster Series Hardware Programming Guide (a 1990s Creative manual), the text
VOC.TXT, which is based on an earlier Creative document and adds Creative’s fax about blocks 8 and 9, and the
descriptions in the MultimediaWiki, the Game Modding wiki and the source code of SoX and FFmpeg.
Disagreements are noted. Creative’s guide calls the version 1.20 (0x0114) “current”.
File header
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 19 | char | identifier | Creative Voice File |
| 19 | 1 | u8 | end-of-file mark | 0x1A, which stopped the DOS TYPE command printing the rest |
| 20 | 2 | u16 | header size | the offset of the first block, usually 26 |
| 22 | 2 | u16 | version | major in the high byte, minor in the low byte: 0x010A is 1.10 and 0x0114 is 1.20 |
| 24 | 2 | u16 | check | ~version + 0x1234 |
A check word that does not match means the version is invalid. For version 1.10,
~0x010A is 0xFEF5, and adding 0x1234 gives
0x1129, stored as 29 11. For 1.20 the check is
0x111F. SoX’s source calls this a two’s complement, but the worked values
are the one’s complement above.
Block header
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 1 | u8 | type | the block type, 0 to 9 |
| 1 | 3 | u24 | size | the size of the block’s data, without this header |
A type 0 block has no size field. Offsets in the tables below are from the start of a block’s data.
Block types
| Type | Name | Size | Data |
|---|---|---|---|
| 0 | Terminator | none | none; marks the end of the file, and the file may also just end |
| 1 | Sound data | 2 + n | time constant, codec, samples |
| 2 | Sound continue | n | samples, with the settings of the block before |
| 3 | Silence | 3 | length, time constant |
| 4 | Marker | 2 | marker number |
| 5 | Text | n | a zero-terminated string |
| 6 | Repeat start | 2 | repeat count |
| 7 | Repeat end | 0 | none |
| 8 | Extended | 4 | time constant, codec, channels |
| 9 | Sound data, new format | 12 + n | rate, bits, channels, codec, samples |
Type 1: sound data
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 1 | u8 | time constant | sets the sample rate; see Sample rates |
| 1 | 1 | u8 | codec | see Codecs |
| 2 | n | bytes | samples |
If no type 8 block comes right before it, the sound is mono (Creative’s guide: “if this block is alone, the digitized sound channels should be defaulted to mono”); after a type 8 block the attributes of that block are used and these two bytes are ignored. Creative’s guide gives the time constant as 65536 − 256,000,000 ÷ (channels × rate), with only the high byte stored. The Game Modding wiki says this block is generally found only in older files, superseded by type 9. With a Creative ADPCM codec the first sample byte is a reference sample: see Creative ADPCM. FFmpeg treats a block whose size field is 0 as running to the end of the file; the explorer reads it as an empty block.
Type 2: sound continue
Only samples, using the codec and rate of the previous sound data block. Creative’s guide says this block “will only be used when the digitized sound data size exceeds the 3-byte block length (16 megabytes)”, though other tools write it for shorter sounds too. With Creative ADPCM it carries on from the state the block before left.
Type 3: silence
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | u16 | length | the length of the silence in samples, minus 1 |
| 2 | 1 | u8 | time constant | as for type 1 |
The silence lasts length + 1 samples at the block’s own rate. SoX adjusts the length when the silence block’s time constant differs from the sound’s (“some silence-packed files have gratuitously different sample rate codes”); the explorer does the same, counting the silence in the rate of the sound it sits in.
Type 4: marker
A u16 value, used by a program to synchronise sound with animation or
other actions. It can be 1 to 0xFFFE: 0 and 0xFFFF are reserved by the drivers. While playing, the
CT-VOICE and CTVDSK drivers copy the value into the digitized-sound status word when the marker is
reached, so a program can wait for it. VOC.TXT: the driver keeps the most recent marker.
Type 5: text
A zero-terminated ASCII string, for comments.
Types 6 and 7: repeat
Block 6 starts a repeated section. Its data is a u16 count, 1 to 0xFFFE, the number of
times to repeat (Creative’s guide); a value of 0xFFFF repeats for ever. Block 7, with no
data, ends the section, and playback goes back to the block after the most recent block 6.
Is the count the repeats or the plays? The sources disagree by one. The wikis (and the
explorer) say the section is repeated count times after its first play, so it plays count + 1 times (0 plays
once). VOC.TXT says “number of repetitions + 1: 1 to FFFE for 0 to FFFD repetitions”, which makes
count 1 mean no repetition, so the section plays count times. Creative’s guide says only “the number of times
to repeat” and gives a range starting at 1, which fits both. The Sound Blaster: The Official Book
(second edition, chapter 12) says the blocks between are “repeated by the driver for Count + 1 times”,
count 1 to 0xFFFE, 0xFFFF endless: the same words as the MultimediaWiki’s “count + 1 times”, which there means
count + 1 plays. Creative’s CT-VOICE driver documentation (the Norton Guide text posted to alt.sb.programmer on
8 November 1992; discmaster.textfiles.com/view/30670/NN_1992_26.iso/spool/alt/sb/programm/426) says: “The data
sub-blocks between this block and the next End-Repeat Loop sub-block is repeated by the CT-VOICE driver for
(COUNT+1) times. The COUNT (2 bytes) field takes a value from 1 to FFFE hex as a loop count. If COUNT is FFFF
hex, then it is to be an endless loop.” SoX and FFmpeg skip the loops, so they settle nothing. The real file DISCO.VOC (a drum loop) has four loops with counts 7, 3, 3 and 7: played
count + 1 times that is 8, 4, 4 and 8 passes, whole bars; played count times it would be 7, 3, 3 and 7. The
explorer therefore uses count + 1 and treats a count of 0 as one play. This is evidence, not Creative’s word.
Type 8: extended
This block has no audio of its own. It carries only the sound attributes, “usually” for stereo or
high-speed sound data, and it must precede a type 1 block, which follows it immediately
(Creative’s guide and VOC.TXT). The attributes of that type 1 block are then ignored, its
time constant and its codec both. It is one of the new blocks of version 1.20 and above (the fax in
VOC.TXT); older files can carry it as well.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | u16 | time constant | see Sample rates |
| 2 | 1 | u8 | codec | as for type 1 |
| 3 | 1 | u8 | mode | 0 for mono, 1 for stereo: the number of channels minus 1 |
Stereo samples are stored left, then right, as interleaved frames (left, right, left, right, …), the way FFmpeg and the explorer read them. The Game Modding wiki says type 2 follows, which Creative’s guide contradicts (“MUST precede Block Type 1”); the guide is followed. The rate, codec and channels come from this block, as Creative says (FFmpeg and SoX take the codec from the type 1 block instead; for 8-bit stereo files the two are the same). Creative’s example: 44,100 Hz mono and 22,050 Hz stereo have the same time constant. The settings last for that one sound data block.
Type 9: sound data, new format
A block type introduced with VOC files of version 1.20 and above (Creative’s guide and the fax in
VOC.TXT), meant to supersede types 1 and 8: the new drivers record with it. The
MultimediaWiki’s “probably” is settled by those two. A file of an older version that holds a type 9 block
is noted by the explorer. Stereo samples are interleaved frames, left then right; the rate is the real one, never
doubled for stereo; bitsPerSample is the number of bits after compression.
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 4 | u32 | sample rate | the rate in hertz |
| 4 | 1 | u8 | bits per sample | 8 or 16, for example |
| 5 | 1 | u8 | channels | 1 is mono and 2 stereo: the plain count, unlike type 8 |
| 6 | 2 | u16 | codec | see Codecs |
| 8 | 4 | bytes | reserved | padding, zero |
| 12 | n | bytes | samples |
Example
The header of a version 1.10 file, then a type 1 block of 1,000 mono 8-bit samples at 11,111 Hz:
| Offset | Bytes | Meaning |
|---|---|---|
| 0 | 43 72 65 61 74 69 76 65 20 56 6F 69 63 65 20 46 69 6C 65 | Creative Voice File |
| 19 | 1A | end-of-file mark |
| 20 | 1A 00 | header size 26 |
| 22 | 0A 01 | version 1.10 |
| 24 | 29 11 | check |
| 26 | 01 | block type 1 |
| 27 | EA 03 00 | size 1,002 |
| 30 | A6 | time constant 166: 1000000 ÷ (256 − 166) = 11,111 Hz |
| 31 | 00 | codec 0, 8-bit unsigned PCM |
| 32 | 1,000 bytes | samples |
| 1032 | 00 | terminator |
Source: Creative Labs, Sound Blaster Series Hardware Programming Guide, Appendix B “Creative Voice File (VOC) Format” (guide pages B-2 to B-12): the header at 00H to 19H and its check word (B-2, B-3), the block layouts and lengths for types 0 to 9 (B-3 to B-11), the marker, repeat and pause ranges. The repeat-count reading (count + 1) is from Creative’s CT-VOICE text, which the page quotes; the example file at the end was built from the guide’s rules. Everything in this page’s tables was compared with the guide’s text by script, and the viewer was run on the guide’s own time-constant examples.