Line 1: |
Line 1: |
| [[Category:File formats]] | | [[Category:File formats]] |
− | This document is about the format of Banner's CTR Wave files (BCWAV). | + | This document is about the format of Binary CTR Wave files (BCWAV). The structure is very similar to Microsoft's Wave file. |
− | | |
− | The structure is very similar to Microsoft's Wave file. | |
− | | |
− | Banner CWAV total channels must be 2, and the length of the audio in seconds must be 3 seconds or less.
| |
| | | |
| === Overview === | | === 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). | + | 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). |
| | | |
| === Header === | | === Header === |
Line 20: |
Line 16: |
| | 0x004 || 2 || Endianness (0xFEFF = little, 0xFFFE = big) | | | 0x004 || 2 || Endianness (0xFEFF = little, 0xFFFE = big) |
| |- | | |- |
− | | 0x006 || 2 || Header Size (0x40) | + | | 0x006 || 2 || Header Size (0x40 due to [[#Info Block|Info Block]] alignment) |
| |- | | |- |
| | 0x008 || 4 || Version (0x02010000) | | | 0x008 || 4 || Version (0x02010000) |
Line 30: |
Line 26: |
| | 0x012 || 2 || Reserved | | | 0x012 || 2 || Reserved |
| |- | | |- |
− | | 0x014 || 12 || [[BCWAV#Info Block|Info Block]] [[BCWAV#Sized Reference|Sized Reference]] (Offset relative to start of file) | + | | 0x014 || 12 || [[#Info Block|Info Block]] [[#Sized Reference|Sized Reference]] (Offset relative to start of file) |
− | |-
| |
− | | 0x020 || 12 || [[BCWAV#Data Block|Data Block]] [[BCWAV#Sized Reference|Sized Reference]] (Offset relative to start of file)
| |
| |- | | |- |
− | | 0x02C || 20 || Padding | + | | 0x020 || 12 || [[#Data Block|Data Block]] [[#Sized Reference|Sized Reference]] (Offset relative to start of file) |
| |} | | |} |
| | | |
Line 54: |
Line 48: |
| ! MAGIC !! TYPE | | ! MAGIC !! TYPE |
| |- | | |- |
− | | INFO || [[BCWAV#Info Block|Info Block]] | + | | INFO || [[#Info Block|Info Block]] |
| |- | | |- |
− | | DATA || [[BCWAV#Data Block|Data Block]] | + | | DATA || [[#Data Block|Data Block]] |
| |} | | |} |
| | | |
Line 65: |
Line 59: |
| ! OFFSET !! SIZE !! DESCRIPTION | | ! OFFSET !! SIZE !! DESCRIPTION |
| |- | | |- |
− | | 0x000 || 8 || [[BCWAV#Block Header|Block Header]] | + | | 0x000 || 8 || [[#Block Header|Block Header]] |
| |- | | |- |
− | | 0x008 || 1 || [[BCWAV#Encoding|Encoding]] | + | | 0x008 || 1 || [[#Encoding|Encoding]] |
| |- | | |- |
| | 0x009 || 1 || Loop (0 = don't loop, 1 = loop) | | | 0x009 || 1 || Loop (0 = don't loop, 1 = loop) |
Line 81: |
Line 75: |
| | 0x018 || 4 || Reserved | | | 0x018 || 4 || Reserved |
| |- | | |- |
− | | 0x01C || 4 + Count * 8 || [[BCWAV#Channel Info|Channel Info]] [[BCWAV#Reference Table|Reference Table]] | + | | 0x01C || X || [[#Channel Info|Channel Info]] [[#Reference Table|Reference Table]] |
| + | |- |
| + | | X || X || [[#Channel Info|Channel Info]] Entries |
| |} | | |} |
| | | |
− | === Data Block ===
| + | If encoding is DSP ADPCM: |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 90: |
Line 86: |
| ! OFFSET !! SIZE !! DESCRIPTION | | ! OFFSET !! SIZE !! DESCRIPTION |
| |- | | |- |
− | | 0x000 || 8 || [[BCWAV#Block Header|Block Header]] | + | | X || X || [[#DSP ADPCM Info|DSP ADPCM Info]] Entries |
| + | |} |
| + | |
| + | If encoding is IMA ADPCM: |
| + | |
| + | {| class="wikitable" border="1" |
| + | |- |
| + | ! OFFSET !! SIZE !! DESCRIPTION |
| |- | | |- |
− | | 0x008 || [[BCWAV#Block Header|Block Header]] Size - 8 || Data | + | | X || X || [[#IMA ADPCM Info|IMA ADPCM Info]] Entries |
| |} | | |} |
| | | |
− | === Encoding === | + | The info block is aligned to 0x20 bytes. |
| + | |
| + | ==== Encoding ==== |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 110: |
Line 115: |
| |} | | |} |
| | | |
− | === Channel Info === | + | ==== Channel Info ==== |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 116: |
Line 121: |
| ! OFFSET !! SIZE !! DESCRIPTION | | ! OFFSET !! SIZE !! DESCRIPTION |
| |- | | |- |
− | | 0x000 || 8 || Samples [[BCWAV#Reference|Reference]] (Offset relative to [[BCWAV#Data Block|Data Block]] Data field) | + | | 0x000 || 8 || Samples [[#Reference|Reference]] (Offset relative to [[#Data Block|Data Block]] Data field) |
| |- | | |- |
− | | 0x008 || 8 || ADPCM Info [[BCWAV#Reference|Reference]] (Offset relative to [[BCWAV#Channel Info|Channel Info]] start) | + | | 0x008 || 8 || ADPCM Info [[#Reference|Reference]] (Offset relative to Samples [[#Reference|Reference]] field) |
| |- | | |- |
| | 0x010 || 4 || Reserved | | | 0x010 || 4 || Reserved |
| |} | | |} |
| | | |
− | === DSP ADPCM Info === | + | ===== DSP ADPCM Info ===== |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 129: |
Line 134: |
| ! OFFSET !! SIZE !! DESCRIPTION | | ! OFFSET !! SIZE !! DESCRIPTION |
| |- | | |- |
− | | 0x000 || 32 || [[BCWAV#DSP ADPCM Param|Param]] | + | | 0x000 || 32 || [[#DSP ADPCM Param|Param]] |
| |- | | |- |
− | | 0x020 || 6 || [[BCWAV#DSP ADPCM Context|Context]] | + | | 0x020 || 6 || [[#DSP ADPCM Context|Context]] |
| |- | | |- |
− | | 0x026 || 6 || Loop [[BCWAV#DSP ADPCM Context|Context]] | + | | 0x026 || 6 || Loop [[#DSP ADPCM Context|Context]] |
| + | |- |
| + | | 0x02C || 2 || Padding |
| |} | | |} |
| | | |
− | === DSP ADPCM Param === | + | ====== DSP ADPCM Param ====== |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 145: |
Line 152: |
| |} | | |} |
| | | |
− | === DSP ADPCM Context === | + | ====== DSP ADPCM Context ====== |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 160: |
Line 167: |
| |} | | |} |
| | | |
− | === IMA ADPCM Info === | + | ===== IMA ADPCM Info ===== |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 166: |
Line 173: |
| ! OFFSET !! SIZE !! DESCRIPTION | | ! OFFSET !! SIZE !! DESCRIPTION |
| |- | | |- |
− | | 0x000 || 4 || [[BCWAV#IMA ADPCM Context|Context]] | + | | 0x000 || 4 || [[#IMA ADPCM Context|Context]] |
| |- | | |- |
− | | 0x004 || 4 || Loop [[BCWAV#IMA ADPCM Context|Context]] | + | | 0x004 || 4 || Loop [[#IMA ADPCM Context|Context]] |
| |} | | |} |
| | | |
− | === IMA ADPCM Context === | + | ====== IMA ADPCM Context ====== |
| | | |
| {| class="wikitable" border="1" | | {| class="wikitable" border="1" |
Line 183: |
Line 190: |
| | 0x003 || 1 || Padding | | | 0x003 || 1 || Padding |
| |} | | |} |
| + | |
| + | === Data Block === |
| + | |
| + | {| class="wikitable" border="1" |
| + | |- |
| + | ! OFFSET !! SIZE !! DESCRIPTION |
| + | |- |
| + | | 0x000 || 8 || [[#Block Header|Block Header]] |
| + | |- |
| + | | 0x008 || [[#Block Header|Block Header]] Size Value - 8 || Data |
| + | |} |
| + | |
| + | The data block is aligned to 0x20 bytes, as well as the data field's actual sample data. |
| | | |
| === Reference Table === | | === Reference Table === |
Line 192: |
Line 212: |
| | 0x000 || 4 || Count | | | 0x000 || 4 || Count |
| |- | | |- |
− | | 0x004 || Count * 8 || [[BCWAV#Reference|References]] (Offsets relative to Count field) | + | | 0x004 || Count * 8 || [[#Reference|References]] (Offsets relative to Count field) |
| |} | | |} |
| | | |
Line 201: |
Line 221: |
| ! OFFSET !! SIZE !! DESCRIPTION | | ! OFFSET !! SIZE !! DESCRIPTION |
| |- | | |- |
− | | 0x000 || 8 || [[BCWAV#Reference|Reference]] | + | | 0x000 || 8 || [[#Reference|Reference]] |
| |- | | |- |
| | 0x008 || 4 || Size | | | 0x008 || 4 || Size |
Line 225: |
Line 245: |
| ! ID !! TYPE | | ! ID !! TYPE |
| |- | | |- |
− | | 0x0300 || [[BCWAV#DSP ADPCM Info|DSP ADPCM Info]] | + | | 0x0300 || [[#DSP ADPCM Info|DSP ADPCM Info]] |
| |- | | |- |
− | | 0x0301 || [[BCWAV#IMA ADPCM Info|IMA ADPCM Info]] | + | | 0x0301 || [[#IMA ADPCM Info|IMA ADPCM Info]] |
| |- | | |- |
− | | 0x1F00 || [[BCWAV#Data_Block|Sample Data]] | + | | 0x1F00 || [[#Data_Block|Sample Data]] |
| |- | | |- |
− | | 0x7000 || [[BCWAV#Info Block|Info Block]] | + | | 0x7000 || [[#Info Block|Info Block]] |
| |- | | |- |
− | | 0x7001 || [[BCWAV#Data Block|Data Block]] | + | | 0x7001 || [[#Data Block|Data Block]] |
| |- | | |- |
− | | 0x7100 || [[BCWAV#Channel Info|Channel Info]] | + | | 0x7100 || [[#Channel Info|Channel Info]] |
| |} | | |} |