This is an old revision of the document!
Table of Contents
NSPC File Format
NSPC is a file format designed to contain all the data necessary to play music from Nintendo's Kankichi-kun/N-SPC music format.
Structure
An NSPC file contains a simple header, followed by a number of variable-length audio packs, followed by optional FIR coefficient tables and APEv2 tags.
Header
The header is 32 bytes long.
| Offset | Size | Purpose | Description |
|---|---|---|---|
| 0 | 4 | Variant | Identifies the variant of NSPC. See valid identifiers below. |
| 4 | 2 | Sequence address | The SPC700 address that the song's sequence data is loaded to. |
| 6 | 2 | Instrument table | The SPC700 address that the song's instrument table is loaded to. |
| 8 | 2 | Sample directory | The SPC700 address where the BRR samples are expected to be found. |
| 10 | 1 | Release table | The id of the release table to use. |
| 11 | 1 | Volume table | The id of the volume table to use. |
| 12 | 19 | Variant-specific | Variant-specific data. See variant information for details. |
| 31 | 1 | FIR coefficients | Number of FIR coefficients embedded in file. If 0, use defaults. |
Audio Pack Format
An audio pack is a chunk of binary data, prefixed with two 16-bit unsigned integers. Size, followed by length, followed by length bytes of binary data. The last pack MUST have a 16-bit null terminator immediately following it.
FIR Coefficient Table
This is a chunk of binary data, with a byte length equal to the FIR coefficient table length times eight.
Variants
0 - Standard
This is the most common variant. The unmodified Kankichi-kun supplied to game developers uses this format.
1 - Prototype
This is an early version of variant 0, used in early SNES games like Super Mario World.
2 - Konami
This is a heavily modified variant 0, with several changed commands. Details are largely unknown.
3 - AddMusicK
This is an upgraded version of variant 0, with many new commands. Designed for use in Super Mario World ROM hacks.