Welcome back.
Figured out a few things last month, specifically how mute numbers work (they determine which audio tracks are played at each layer), how to build a custom soundbank that the game can read, and thanks to Pyrite from youtube, what fpb files are for. Will write up more notes on custom mpb soundbanks once i get my test midi to work properly.
Mpb files can be created using the DLS2TB.exe file from the Dreamcast SDK. This converts DLS Level 1 soundbanks to the mpb format. The converted mpb file will need a byte in its header changed from 01 to 02 in order to function properly.
Midi files contain the music sequence data and meta event data, as well as the mute number data.
Mpb files contain the audio samples.
Fpb files are responsible for telling the game what audio effects to use on each midi channel.
Pasting my notes on mute numbers, using Area 1 from the final game (M01.MID).
------------------
Each midi file used in the game has a KMD0 section within them, at the end of the midi data. If the KMD0 section is missing, the game will activate Every midi track and you won't be able to turn them off from the sound debug menu.
This section MUST start as soon as the midi file ends. If KMD0 starts misaligned (ie not on a 1st, 5th, 9th or 13th byte), pad with FF AFTER the section size in the header, so the 00's after the FF's are aligned. If you do not align the KMD0 section data, the game will read incorrect bytes for the mute numbers.
KMD0 header=
<KMD0 (4 bytes)> + <Section size (4 bytes)> + <FF bytes if misaligned>
6 bytes of unknown data follows the header.
Mute Numbers=
Each one is 12 bytes.
eg <01 00 00 00 00 00 00 00 0f 51 04 00>
First byte decides whether to restart the midi on a layer change.
00 Continue playing.
01 Restart and play.
Last four bytes determine which tracks to play.
Area 1-
00... 80 00 00 00 = 7.
00... 86 00 00 00 = 1, 2, 7.
00... 86 00 40 00 = 1, 2, 7, 22.
00... 8e 00 40 00 = 1, 2, 3, 7, 22.
01... 00 03 00 00 = 8, 9.
00... 1e 03 00 00 = 1, 2, 3, 4, 8, 9.
00... 1e 28 40 00 = 1, 2, 3, 4, 11, 13, 22.
00... 1f 2c 40 00 = 0, 1, 2, 3, 4, 10, 11, 13, 22.
01... 08 11 04 00 = 3, 8, 12, 18.
01... 0f 51 04 00 = 0, 1, 2, 3, 8, 12, 14, 18.
00... 0f 55 04 00 = 0, 1, 2, 3, 8, 10, 12, 14, 18.
The tracks activated are determined based on the reversed binary values of the last 4 hex bytes. Each byte is responsible for controlling 8 tracks, with a limit of 32 in total. Tracks in game start on 0 instead of 1.
e.g
1f 2c 40 00
00011111 00101100 01000000 00000000
1st= 0 1 2 3 4 ON, 5 6 7 OFF.
2nd= 10 11 13 ON, 8 9 12 14 15 OFF.
3rd= 22 ON, 16 17 18 19 20 21 23 OFF.
4th= 24 25 26 27 28 29 30 31 OFF.
Following from this, the boss sections (If the level has a boss) are defined in the same way. These mute numbers aren't accessible from the sound debug menu however.
All KMD0 sections end with
FF FF FF FF 00 00 00 00 00 00 00 00.
This IS supposed to be included in the KMD0 section size.
------------------
I hope this makes sense, feel free to ask questions if you're confused and i'll try to help to the best of my ability.
As far as custom music goes, I managed to get a custom kick drum sample into the game, but now I have to figure out why the game is playing the custom midi file too fast despite having the (supposedly) correct meta events set up.
Figured out a few things last month, specifically how mute numbers work (they determine which audio tracks are played at each layer), how to build a custom soundbank that the game can read, and thanks to Pyrite from youtube, what fpb files are for. Will write up more notes on custom mpb soundbanks once i get my test midi to work properly.
Mpb files can be created using the DLS2TB.exe file from the Dreamcast SDK. This converts DLS Level 1 soundbanks to the mpb format. The converted mpb file will need a byte in its header changed from 01 to 02 in order to function properly.
Midi files contain the music sequence data and meta event data, as well as the mute number data.
Mpb files contain the audio samples.
Fpb files are responsible for telling the game what audio effects to use on each midi channel.
Pasting my notes on mute numbers, using Area 1 from the final game (M01.MID).
------------------
Each midi file used in the game has a KMD0 section within them, at the end of the midi data. If the KMD0 section is missing, the game will activate Every midi track and you won't be able to turn them off from the sound debug menu.
This section MUST start as soon as the midi file ends. If KMD0 starts misaligned (ie not on a 1st, 5th, 9th or 13th byte), pad with FF AFTER the section size in the header, so the 00's after the FF's are aligned. If you do not align the KMD0 section data, the game will read incorrect bytes for the mute numbers.
KMD0 header=
<KMD0 (4 bytes)> + <Section size (4 bytes)> + <FF bytes if misaligned>
6 bytes of unknown data follows the header.
Mute Numbers=
Each one is 12 bytes.
eg <01 00 00 00 00 00 00 00 0f 51 04 00>
First byte decides whether to restart the midi on a layer change.
00 Continue playing.
01 Restart and play.
Last four bytes determine which tracks to play.
Area 1-
00... 80 00 00 00 = 7.
00... 86 00 00 00 = 1, 2, 7.
00... 86 00 40 00 = 1, 2, 7, 22.
00... 8e 00 40 00 = 1, 2, 3, 7, 22.
01... 00 03 00 00 = 8, 9.
00... 1e 03 00 00 = 1, 2, 3, 4, 8, 9.
00... 1e 28 40 00 = 1, 2, 3, 4, 11, 13, 22.
00... 1f 2c 40 00 = 0, 1, 2, 3, 4, 10, 11, 13, 22.
01... 08 11 04 00 = 3, 8, 12, 18.
01... 0f 51 04 00 = 0, 1, 2, 3, 8, 12, 14, 18.
00... 0f 55 04 00 = 0, 1, 2, 3, 8, 10, 12, 14, 18.
The tracks activated are determined based on the reversed binary values of the last 4 hex bytes. Each byte is responsible for controlling 8 tracks, with a limit of 32 in total. Tracks in game start on 0 instead of 1.
e.g
1f 2c 40 00
00011111 00101100 01000000 00000000
1st= 0 1 2 3 4 ON, 5 6 7 OFF.
2nd= 10 11 13 ON, 8 9 12 14 15 OFF.
3rd= 22 ON, 16 17 18 19 20 21 23 OFF.
4th= 24 25 26 27 28 29 30 31 OFF.
Following from this, the boss sections (If the level has a boss) are defined in the same way. These mute numbers aren't accessible from the sound debug menu however.
All KMD0 sections end with
FF FF FF FF 00 00 00 00 00 00 00 00.
This IS supposed to be included in the KMD0 section size.
------------------
I hope this makes sense, feel free to ask questions if you're confused and i'll try to help to the best of my ability.
As far as custom music goes, I managed to get a custom kick drum sample into the game, but now I have to figure out why the game is playing the custom midi file too fast despite having the (supposedly) correct meta events set up.