RAS (File Format)
From Wexos's Wiki
RAS (RetroStudio 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 | Unknown, possibly number of channels or format. |
| 0x08 | UInt32 | Unknown, possibly number of channels or format. |
| 0x0C | UInt32 | Unknown. |
| 0x10 | UInt32 | Unknown. |
| 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. |
| 0x2C | UInt32 | Possibly number of samples in the last block. |
| 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. |
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 | UInt16 | 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. |
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: