This document is about the format of Binary CTR Wave files (BCWAV). The structure is very similar to Microsoft's Wave file.
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).
OFFSET |
SIZE |
DESCRIPTION
|
0x000 |
4 |
Magic (CWAV)
|
0x004 |
2 |
Endianness (0xFEFF = little, 0xFFFE = big)
|
0x006 |
2 |
Header Size (0x40 due to Info Block alignment)
|
0x008 |
4 |
Version (0x02010000)
|
0x00C |
4 |
File Size
|
0x010 |
2 |
Number of Blocks (2)
|
0x012 |
2 |
Reserved
|
0x014 |
12 |
Info Block Sized Reference (Offset relative to start of file)
|
0x020 |
12 |
Data Block Sized Reference (Offset relative to start of file)
|
OFFSET |
SIZE |
DESCRIPTION
|
0x000 |
4 |
Magic
|
0x004 |
4 |
Size
|
Block TypesEdit
Info BlockEdit
If encoding is DSP ADPCM:
If encoding is IMA ADPCM:
The info block is aligned to 0x20 bytes.
VALUE |
DESCRIPTION
|
0 |
PCM8
|
1 |
PCM16
|
2 |
DSP ADPCM
|
3 |
IMA ADPCM
|
Channel InfoEdit
DSP ADPCM InfoEdit
DSP ADPCM ParamEdit
OFFSET |
SIZE |
DESCRIPTION
|
0x000 |
32 |
16-bit Coefficients
|
DSP ADPCM ContextEdit
OFFSET |
SIZE |
DESCRIPTION
|
0x000 |
1 |
4-bit Predictor + 4-bit Scale
|
0x001 |
1 |
Reserved
|
0x002 |
2 |
Previous Sample
|
0x004 |
2 |
Second Previous Sample
|
IMA ADPCM InfoEdit
IMA ADPCM ContextEdit
OFFSET |
SIZE |
DESCRIPTION
|
0x000 |
2 |
Data
|
0x002 |
1 |
Table Index
|
0x003 |
1 |
Padding
|
Data BlockEdit
The data block is aligned to 0x20 bytes, as well as the data field's actual sample data.
Reference TableEdit
OFFSET |
SIZE |
DESCRIPTION
|
0x000 |
4 |
Count
|
0x004 |
Count * 8 |
References (Offsets relative to Count field)
|
Sized ReferenceEdit
OFFSET |
SIZE |
DESCRIPTION
|
0x000 |
8 |
Reference
|
0x008 |
4 |
Size
|
ReferenceEdit
OFFSET |
SIZE |
DESCRIPTION
|
0x000 |
2 |
Type ID
|
0x002 |
2 |
Padding
|
0x004 |
4 |
Offset ("null" = 0xFFFFFFFF)
|
Reference TypesEdit