BCSTM

BCSTM

This document is about the format of CTR Streams (CSTM).

Overview #

The structure is similar to that of a BCWAV, with a few differences, such as its different INFO block format, the addition of a SEEK block, and the organization of the DATA block samples into blocks.

These files are either found in rom:\sound\stream\ or they can be inside of a CSAR.

OFFSETSIZEDESCRIPTION
0x0004Magic (CSTM)
0x0042Endianness (0xFEFF = little, 0xFFFE = big)
0x0062Header Size (0x40 due to Info Block alignment)
0x0084Version (0x02000000)
0x00C4File Size
0x0102Number of Blocks (3)
0x0122Reserved
0x01412Info Block Sized Reference (Offset relative to start of file)
0x02012Seek Block Sized Reference (Offset relative to start of file)
0x02C12Data Block Sized Reference (Offset relative to start of file)

Block Header #

OFFSETSIZEDESCRIPTION
0x0004Magic
0x0044Size

Block Types #

MAGICTYPE
INFOInfo Block
SEEKSeek Block
DATAData Block

Info Block #

OFFSETSIZEDESCRIPTION
0x0008Block Header
0x0088Stream Info Reference (Offset relative to this field)
0x0108Track Info Reference Table Reference (Offset relative to Stream Info Reference field)
0x0188Channel Info Reference Table Reference (Offset relative to Stream Info Reference field)
0x02056Stream Info
0x058XTrack Info Reference Table
XXChannel Info Reference Table
XXTrack Info Entries
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

Stream Info #

OFFSETSIZEDESCRIPTION
0x0001Encoding
0x0011Loop (0 = don’t loop, 1 = loop)
0x0021Channel Count
0x0031Padding
0x0044Sample Rate
0x0084Loop Start Frame
0x00C4Loop End Frame
0x0104Sample Block Count
0x0144Sample Block Size
0x0184Sample Block Sample Count
0x01C4Last Sample Block Size
0x0204Last Sample Block Sample Count
0x0244Last Sample Block Padded Size
0x0284Seek Data Size
0x02C4Seek Interval Sample Count
0x0308Sample Data Reference (Offset relative to Data Block Data field)

Track Info #

OFFSETSIZEDESCRIPTION
0x0001Volume
0x0011Pan
0x0022Padding
0x0048Channel Index Byte Table Reference (Offset relative to Volume field)
0x00CXChannel Index Byte Table (Padded to 4 bytes)
Byte Table #
OFFSETSIZEDESCRIPTION
0x0004Count
0x004CountElements

Channel Info #

OFFSETSIZEDESCRIPTION
0x0008ADPCM Info Reference (Offset relative to this field)
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

Seek Block #

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

The seek block is aligned to 0x20 bytes.

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
0x0100Byte Table
0x0101Reference Table
0x0300DSP ADPCM Info
0x0301IMA ADPCM Info
0x1F00Sample Data
0x4000Info Block
0x4001Seek Block
0x4002Data Block
0x4100Stream Info
0x4101Track Info
0x4102Channel Info

Tools #

The following tools can play BCSTMs and convert them to other formats:

Category:File formats