News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Super Mario Kart music format  (Read 3270 times)


  • Guest
Super Mario Kart music format
« on: August 05, 2012, 03:03:23 pm »
I've used Stifu's guide to decompress some music in Super Mario Kart but...I don't know how to replace what I've got. Any help?


  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Super Mario Kart music format
« Reply #1 on: August 05, 2012, 07:19:31 pm »
Decide on a suitable replacement, compress that and then replace the old compressed data with the new compressed data.


  • Guest
Re: Super Mario Kart music format
« Reply #2 on: August 05, 2012, 09:57:19 pm »
I'm stuck on the "suitable replacement" part. I can't just compress a generic midi and expect it to work, can I?


  • Jr. Member
  • **
  • Posts: 46
    • View Profile
Re: Super Mario Kart music format
« Reply #3 on: August 07, 2012, 01:14:47 pm »
Super Mario Kart uses the N-SPC sound engine, variants of which are used by several first-party Nintendo games, as well as others.

In several of the first-party titles I've looked at, an uncompressed block of N-SPC data as extracted from a ROM usually begins a with header consisting of two 16-bit values:

  • The length of the data block following the header
  • The destination in SPC RAM to write this block of data to

After each block of data, you may either see another header specifying the length and destination for an additional block of data, or 0000 followed by another non-zero value (usually the starting location of the main engine code itself).  The latter is used to tell the SNES CPU to stop uploading to SPC RAM.

Here are some documents about the most common format (which is what SMK uses):

Since the N-SPC data itself relies heavily on pointers to where things are located in SPC RAM, it helps to dump an SPC file of the song you want to edit.  This can be done in ZSNES or Snes9x.

Here is where each song's data begins in Super Mario Kart's SPC RAM. To get the starting location in an SPC file, you must add 0x100 to the address.  The song pointers can be found at 1566-1591 in SPC RAM.

Value       Address in SPC RAM   Description
-----       ------------------   -----------
01          FF00                 Mario Kart GP intro
02          07CA                 Starting lights (Time Trial/Match Race/Battle Mode)
03          D783                 Starting lights with engine sounds (Mario Kart GP)
04          D000                 Track-specific music (normal tempo)
05          3E45                 Final Lap fanfare
06          D000                 Track-specific music (speeds up to final lap tempo in 2nd pattern; unused)
07          D000                 Track-specific music (final lap tempo)
08          10BF                 Using Starman
09          DAF9                 1st-4rd place finish (Mario Kart GP)/Finish with a new record (Time Trial)
0A          03DB                 Finish without a new record (Time Trial)
0B          06F0                 Ranked Out
0C          DD3B                 Mario's Theme
0D          DC37                 Luigi's Theme
0E          0506                 Bowser's Theme
0F          D989                 Princess's Theme
10          124E                 Donkey Kong Jr.'s Theme
11          05FE                 Koopa Troopa's Theme
12          3D24                 Toad's Theme
13          13D7                 Yoshi's Theme
14          DE33                 Game Over
15          D000                 Track-specific music (faster than final lap; unused)
16          D000                 Track-specific music (normal tempo)