BNS (File Format)

From Wexos's Wiki
Revision as of 17:15, 1 May 2024 by Wexos (talk | contribs) (Imported from avsys wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

BNS (BaNner Sound) is a file format used for storing Wii channel sound data.

File Format

Header

The file starts with the following header:

Offset Type Description
0x00 Char[4] File magic. Always BNS in ASCII.
0x04 UInt16 Byte-order-mark. FE FF for big endian, FF FE for little endian.
0x06 UInt16 Version number of the file format.
0x08 UInt32 File size in bytes.
0x0C UInt16 Header size in bytes.
0x0E UInt16 Number of sections stored in the file.
0x10 UInt32 INFO offset.
0x14 UInt32 INFO section size in bytes.
0x18 UInt32 DATA offset.
0x1C UInt32 DATA section size in bytes.

INFO

The INFO section stores general information about the sound. Unlike BRSTM and BRWAV, the format is always DSP ADPCM. All offsets are relative to 0x08 into the following structure:

Offset Type Description
0x00 Char[4] Section magic. Always INFO in ASCII.
0x04 UInt32 Section size in bytes.
0x08 Byte Dummy value, always 0.
0x09 Byte Loop flag.
0x0A Byte Number of channels.
0x0B Byte Sample rate 24. Contains the upper byte of a 24-bit value.
0x0C UInt16 Sample rate.
0x0E UInt16 Block header start.
0x10 UInt32 Loop start in frames.
0x14 UInt32 Loop end in frames.
0x18 UInt32 Channel table offset. Points an array of offsets which point to each channel.
0x1C UInt32 Unknown.

Channel

Each channel has the following structure:

Offset Type Description
0x00 UInt32 Data offset into the sound data.
0x04 UInt32 Channel info offset.
0x08 UInt32 Unknown.

Channel Info

A channel info contains data used to decode DSP ADPCM sound data. Each entry has the following structure:

Offset Type Description
0x00 Int16[8][2] Coefficients.
0x20 UInt16 Gain.
0x22 UInt16 Pred scale.
0x24 Int16 Yn 1. History sample 1.
0x26 Int16 Yn 2. History sample 2.
0x28 UInt16 Loop pred scale.
0x2A Int16 Loop yn 1. Loop history sample 1.
0x2C Int16 Loop yn 2. Loop history sample 2.
0x2E Byte[2] Padding.

DATA

Offset Type Description
0x00 Char[4] Section magic. Always DATA in ASCII.
0x04 UInt32 Section size in bytes.
0x08 Byte[] Sound data.

Tools

The following tools can handle BNS files:

  • (none)