RAS (File Format)
From Wexos's Wiki
Jump to navigationJump to search
RAS (RetroStudios Audio Stream?) is a streamable audio file format used in Donkey Kong Country Returns.
File Format
Header
The file starts with the following header:
| Offset | Type | Description |
|---|---|---|
| 0x00 | Char[4] | File magic. Always RAS_ (0x5241535F) in ASCII. |
| 0x04 | UInt32 | Version number. Always 2 in Donkey Kong Country Returns. |
| 0x08 | UInt32 | Number of channels. |
| 0x0C | UInt32 | Unknown. Seems to be some size related to the last block. |
| 0x10 | UInt32 | Number of unknowns. |
| 0x14 | UInt32 | Sample rate in Hz. |
| 0x18 | UInt32 | Sound data offset. |
| 0x1C | UInt32 | Sound data size in bytes. |
| 0x20 | UInt32 | Block size in bytes. |
| 0x24 | UInt32 | Number of blocks per channel. |
| 0x28 | UInt32 | Unknown, seems to be some sort of size in bytes or samples. |
| 0x2C | UInt32 | Number of samples in the last block per channel. |
| 0x30 | UInt32 | Loop start block index. |
| 0x34 | UInt32 | Loop start sample into the loop start block specified above. |
| 0x38 | UInt32 | Loop end block index. |
| 0x3C | UInt32 | Loop end sample into the loop end block specified above. |
The file has looping defined if loop end block index or loop end smaple is not zero.
DSP ADPCM Channel Info
After the header there is a DSP ADPCM channel info data structure, one per channel. It has the following structure:
| Offset | Type | Description |
|---|---|---|
| 0x00 | Int16[8][2] | 16-bit Coefficients. |
| 0x20 | UInt16 | Gain. |
| 0x22 | Int16 | Pred scale. |
| 0x24 | Int16 | Yn 1. |
| 0x26 | Int16 | Yn 2. |
| 0x28 | UInt16 | Loop pred scale. |
| 0x2A | Int16 | Loop Yn 1. |
| 0x2C | Int16 | Loop Yn 2. |
| 0x2E | byte[2] | Padding. |
Unknown
After channel infos, there is an unknown structure with the following layout:
| Offset | Type | Description |
|---|---|---|
| 0x00 | Float | Unknown. |
| 0x04 | UInt32 | Unknown. |
| 0x08 | UInt16 | Unknown. |
| 0x0A | Byte[2] | Unknown. |
| 0x0C | UInt32 | Unknown. |
Sound Data
The sound data is stored in DSP ADPCM format. The header may allow specifying other formats, but it is currently unknown if that is the case.
Tools
The following tools can handle RAS files: