So here are some recent notes on this format.
And some random stuff converted-ish to SPC.
SML Overworld
SML Ruins
SMBDX Overworld
SML2 Level
N-GBS Music Engine
DJ Bouche (Andrew Lim)
2011-12-20
Known Games and Variants
Super Mario Land - NGBS0 (Song Table 0x663C)
Super Mario Land 2 - NGBS1
Super Mario Bros DX - NGBS0
This is based on studying the GBS. The data was first found by poking real-time RAM in an emulator.
Song Format:
NGBS0: nn ll ll aa aa bb bb cc cc dd dd
NGBS1: nn ll ll mm mm aa aa bb bb cc cc dd dd
nn - ?????
llll - pointer to length table
mmmm - pointer to ???
aaaa - pointer to channel 1 sequence
bbbb - pointer to channel 2 sequence
cccc - pointer to channel 3 sequence
dddd - pointer to channel 4 sequence
Length Table:
Contains tick value for each length index (0-F), one byte for each
Track Sequence:
Looping track - aa aa bb bb cc cc dd dd ..... FF FF pp pp
Non-looping track - aa aa bb bb 00 00
aaaa, bbbb, cccc, dddd, ... - pointer to patterns (command streams)
pppp - pointer to the loop point in the track sequence
Note that if 00 00 is reached in any track sequence, it ends the entire song (all other tracks stop processing too).
Command Stream:
Added in NGBS1
9B xx - Loop Start
xx - Number of loops
9C - Loop End
Basic Commands
00 - end of command stream
99 - unknown
9D xx yy zz - set channel info
For Ch 1 and 2
xx - Volume Envelope
yy - ??
zz - Duty (bits 6 and 7)
For Ch 3
yyxx - Address of Waveform
yy - ??
For Ch 4
Is just read as a note, I think, as Ch4 doesn't use this command
A0-AF - set note length (A0 is length index 0, AF is length index F)
01 - Note Rest
Anything else, that is not 01, A0-AF, or any recognized command above, is interpreted as a note.
For Ch 1-3:
Note is an even number (it is actually an index to a 16-bit word table of frequencies)
02 is C0, 04 is C#0, 06 is D0, etc.
Odd numbers will work but they will point to invalid (misaligned) frequencies
For Ch 4:
02, 03, 04, 05 .. etc correspond to a drum note
How those drum notes are specified I don't know yet
Super Mario Land's Auto-pan:
Don't know where this is yet, it's not part of the song data, at all..
Noise drum notes:
Don't know yet.
Here is the overworld song decoded to BPCSPK3, with comments:
*Song 07 - 6FDA (0A66) - Length Table 6F66 (09F2)*
( *Track 00 - 76ED (1179)*
*Pattern 00 - 7728 (11B4)*
&GBP[0x62][0x00][0x80] 64 / 8 / 24 O1 g 32 < g *End Pattern*
: *Pattern 01 - 775E (11EA)*
16 / O2 e/e/e/e/e/e/e/e/ > c/c/c/c 64 / 16 / > f# 32 f# 16 / << e/e/e/e/e/e/e/e/ > c/c/c/c 64 / 12 / 4 > f# 16 / 32 < f# *End Pattern*
*Pattern 02 - 7866 (12F2)*
16 / O3 cd < a > d 12 < g 4 b 16 /gaf 12 b 4 a 16 d 64 / 16 / > cd < a > d 12 < g 4 b 16 /gcc/c//// *End Pattern*
*Loop to Position 01*
|
( *Track 01 - 76F7 (1183)*
*Pattern 00 - 7715 (11A1)*
&GBP[0x92][0x00][0x80] 8 O3 e/d#/dc/// 24 < g 32 < g *End Pattern*
: *Pattern 01 - 77A2 (122E)*
16 O3 e/ 12 d 4 c 12 / 4 e 48 / 12 c 4 d 8 e/e/ 16 dcefga/cc < ag 12 / 4 > c 32 / 16 < fgab 16 / >> g 32 g 16 < e/ 12 d 4 c 12 / 4 e 48 / 12 c 4 d 8 e/e/ 16 dcag > c 12 < e 4 d 16 /ccde 12 / 4 c 32 / 16 fecd 12 / 4 > g 16 / 32 < g *End Pattern*
*Pattern 02 - 7832 (12BE)*
16 / O3 ab > c 16 < b 12 / 4 g 32 / 16 f/ 12 g 4 f 16 / 8 e/f/f#/g/ 16 /ab > c 16 < b 12 / 4 g 32 / 16 > d#d/c 64 / *End Pattern*
*Loop to Position 01*
|
( *Track 02 - 7701 (118D)*
*Pattern 00 - 7735 (11C1)*
&WAV[0x6F3B][0x9C7] 8 O4 g/f#/fe// 32 / << g *End Pattern*
: *Pattern 01 - 780E (129A)*
$a~(16 O2 c 12 > g 4 << g 16 > c > g < c > g# < c > g# < c > a < c > a < c > a# < a > a# < f > a < f > a < e > g < e > gdeff# 64 /) *End Pattern*
*Pattern 02 - 780E (129A)*
$a *End Pattern*
*Pattern 03 - 7893 (131F)*
16 O2 f > c < f > c < e > c < e > c < d > a < d > a 8 c/d/d#/e/ 16 < f > c < f > c < e > c < e > c < g# > d# < g# > d# 4 g/g/ 8 f/e/d/ *End Pattern*
*Loop to Position 01*
|
( *Track 03 - 770D (1199)*
*Pattern 00 - 7746 (11D2)*
12 O8 f 4 f 16 a# 12 f 4 f 16 a# 8 /f// 12 a# 4 f 16 f *End Pattern*
: *Pattern 01 - 78C3 (134F)*
16 O8 f 12 f 4 f 16 a# 12 f 4 f 16 f 12 f 4 f 16 a# 12 f 4 f *End Pattern*
*Loop to Position 01*
|