AAL > Audio Metadata (BAMETA)

This file is part of a BARS file and contains metadata about an audio resource.

OffsetSizeDescription
0x04Magic number ("AMTA")
0x42BOM (always 0xFEFF)
0x62Version number (0x0100, 0x0300 or 0x0400)
0x84Filesize
0xC4Offset to data section
0x104Offset to marker section
0x144Offset to ext section. Only present in version 3.0 and 4.0
0x14 or 0x184Offset to string table section

The file is padded with null bytes at the end such that its size is a multiple of 4.

Data Section

Header:

OffsetSizeDescription
0x04Identifier ("DATA")
0x44Body size

Body:

OffsetSizeDescription
0x04Asset name (offset into string table)
0x44Number of output samples at 48000 Hz
0x81Type (0=Wave, 1=Stream)
0x91Total number of channels
0xA1Number of stream tracks (up to 8)
0xB1Flags:
1 = unknown
2 = unknown
4 = is looped
8 = unknown
16 = unknown
0xC4Unknown (float)
0x104Sample rate
0x144Loop start sample
0x184Number of samples
0x1C4Volume in decibel (float). This is always negative. Calculate the real volume as follows: 10 ** (value / 20).
0x208 * 8Stream tracks
0x604Amplitude peak value (float). Only present in version 4.0

Stream Track

OffsetSizeDescription
0x04Number of channels
0x44Volume (float)

Marker Section

Header:

OffsetSizeDescription
0x04Identifier ("MARK")
0x44Body size

Body:

OffsetSizeDescription
0x04Number of entries
0x4Marker infos

Marker Info

OffsetSizeDescription
0x04Id
0x44Name (offset into string table)
0x84Start pos
0xC4Length

Ext Section

Header:

OffsetSizeDescription
0x04Identifier ("EXT_")
0x44Body size

Body:

OffsetSizeDescription
0x04Number of entries
0x4Ext entries

Ext Entry

OffsetSizeDescription
0x04Name (offset into string table)
0x44Value (float)

String Table Section

Nintendo's tools are broken.

Obviously, an offset into the string table should be measured in bytes. However, Nintendo's tooling counts the number of characters instead. Thus, if a string contains non-ascii characters, all offsets to strings that come after it are wrong.

OffsetSizeDescription
0x04Identifier ("STRG")
0x44Body size
0x8Body (null-terminated strings)

Duplicate strings are stored in the string table only once.