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

The structure is almost exact to the CTR Wave Format (CWAV).

Overview

The structure of the CSTM is almost exactly the CWAV, except a few differences. The formats can be easily converted between eachother.

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

Format

CSTM Header

OFFSET SIZE DESCRIPTION
0x000 4 MAGIC "CSTM"
0x004 2 Endianess (0xFEFF=LE / 0xFFFE=BE)
0x00C 4 Filesize

INFO Header

OFFSET SIZE DESCRIPTION
0x000 4 Magic "INFO"
0x004 4 Length
0x020 1 Type (00 = PCM8, 01 = PCM16, 02 = DSPADPCM)
0x021 1 Loop Flag
0x022 2 Total Channels
0x024 4 Sample Rate
0x028 4 Unknown
0x02C 4 Total samples
0x030 X The Channels' Data Pointers
X X The Channels' Data

DATA Header

OFFSET SIZE DESCRIPTION
0x000 4 Magic "DATA"
0x004 4 Length
0x020 X Start of Channels' Data

Unlike CWAV, if there are 2 channels in a CSTM they alternate every 0x2000 bytes of the DATA partition starting at 0x20. The last section of each channel is usually less than 0x2000, the lengths of these channels is stored in the INFO Header.

Additionally it introduces a new partition called SEEK which comes right before DATA, so a CSTM would be ordered like this:

  • CSTM Header
  • INFO Partition
  • SEEK Partition
  • DATA Partition

By default this means that 0x24-0x2B in the CSTM Partition is the SEEK position and length respectively, and DATA position and length follows it (in a CWAV 0x24-0x2B is usually the DATA position and length).

SEEK

OFFSET SIZE DESCRIPTION
0x000 4 Magic (SEEK)
0x004 4 Length