BCWAV

BCWAV

This document is about the format of Binary CTR Wave files (BCWAV). The structure is very similar to Microsoft’s Wave file.

Overview #

Microsoft’s WAV structure is RIFF Header which defines the data inside which is WAVE, then the media player expects a “fmt " chunk and a “data” chunk. Nintendo’s format uses a CWAV header (no need for a general structure for media, only wave), which points to an INFO struct (the equivalent to fmt) and a DATA struct (the equivalent to data).

OFFSETSIZEDESCRIPTION
0x0004Magic (CWAV)
0x0042Endianness (0xFEFF = little, 0xFFFE = big)
0x0062Header Size (0x40 due to Info Block alignment)
0x0084Version (0x02010000)
0x00C4File Size
0x0102Number of Blocks (2)
0x0122Reserved
0x01412Info Block Sized Reference (Offset relative to start of file)
0x02012Data Block Sized Reference (Offset relative to start of file)

Block Header #

OFFSETSIZEDESCRIPTION
0x0004Magic
0x0044Size

Block Types #

MAGICTYPE
INFOInfo Block
DATAData Block

Info Block #

OFFSETSIZEDESCRIPTION
0x0008Block Header
0x0081Encoding
0x0091Loop (0 = don’t loop, 1 = loop)
0x00A2Padding
0x00C4Sample Rate
0x0104Loop Start Frame
0x0144Loop End Frame
0x0184Reserved
0x01CXChannel Info Reference Table
XXChannel Info Entries

If encoding is DSP ADPCM:

OFFSETSIZEDESCRIPTION
XXDSP ADPCM Info Entries

If encoding is IMA ADPCM:

OFFSETSIZEDESCRIPTION
XXIMA ADPCM Info Entries

The info block is aligned to 0x20 bytes.

Encoding #

VALUEDESCRIPTION
0PCM8
1PCM16
2DSP ADPCM
3IMA ADPCM

Channel Info #

OFFSETSIZEDESCRIPTION
0x0008Samples Reference (Offset relative to Data Block Data field)
0x0088ADPCM Info Reference (Offset relative to Samples Reference field)
0x0104Reserved
DSP ADPCM Info #
OFFSETSIZEDESCRIPTION
0x00032Param
0x0206Context
0x0266Loop Context
0x02C2Padding
DSP ADPCM Param #
OFFSETSIZEDESCRIPTION
0x0003216-bit Coefficients
DSP ADPCM Context #
OFFSETSIZEDESCRIPTION
0x00014-bit Predictor + 4-bit Scale
0x0011Reserved
0x0022Previous Sample
0x0042Second Previous Sample
IMA ADPCM Info #
OFFSETSIZEDESCRIPTION
0x0004Context
0x0044Loop Context
IMA ADPCM Context #
OFFSETSIZEDESCRIPTION
0x0002Data
0x0021Table Index
0x0031Padding

Data Block #

OFFSETSIZEDESCRIPTION
0x0008Block Header
0x008Block Header Size Value - 8Data

The data block is aligned to 0x20 bytes, as well as the data field’s actual sample data.

Reference Table #

OFFSETSIZEDESCRIPTION
0x0004Count
0x004Count * 8References (Offsets relative to Count field)

Sized Reference #

OFFSETSIZEDESCRIPTION
0x0008Reference
0x0084Size

Reference #

OFFSETSIZEDESCRIPTION
0x0002Type ID
0x0022Padding
0x0044Offset (“null” = 0xFFFFFFFF)

Reference Types #

IDTYPE
0x0300DSP ADPCM Info
0x0301IMA ADPCM Info
0x1F00Sample Data
0x7000Info Block
0x7001Data Block
0x7100Channel Info

Category:File formats