Has anybody ripped midi/sf2 data from Metal Gear Solid 1 for the PSX Yet? by Choro at 3:01 PM EST on January 5, 2021
Sorry, I'm very new to this forum but I have been lurking for years. Im not sure if this is the correct way to post, but i've had the curiosity if anyone has managed to rip the mid/sf2 data from Metal Gear Solid yet, I got the PSF pack from that joshw site and tried to extract them with VGMTrans, at best all what I managed to obtain are all of the samples in Wav, which is a start. No midi data though. Has anyone succeeded in such a feat like this though yet?
by Nisto at 4:21 PM EST on January 5, 2021
I made that PSF rip, and have managed to convert the sequences before.

There is a set of tools available on GitHub to convert some of the MGS1 files. The sequence format in MGS is called MDX so you want the unMDX script mainly. To get the MDX data you could either use the unStg / unStage scripts to extract the MDX files directly from the game, or pull them from the PSF files with something like PSFLab (the data is stored at address 801E0000).
by Choro at 10:58 PM EST on January 5, 2021
Thank you for responding! I cannot get the data extraction tools on github to compile (VS2019), sadly. Where can I find the MDX files or how can I extract them myself from the PSF's directly? I'm using your set.

Update: I've found the data youre referring to in PSFLab. at the 1E0000 area. How do I dump all of it? Do i have to select everything until it's 0 and save it to a hex file, and then save it as a mdx or something?

edited 1:45 AM EST January 6, 2021
by hcs at 11:22 AM EST on January 6, 2021
Those tools are Ruby scripts, you will need Ruby to run them, easiest way to set this up on Windows is RubyInstaller.

edited 11:22 AM EST January 6, 2021
by Nisto at 11:33 AM EST on January 6, 2021
The tools do not require any compiling. You need Ruby (hence .rb file extensions) to run them.

Regarding extracting data, that's my mistake. I thought PSFLab had functionality to export data, but it seems I may have been wrong. One solution would be to export the data as a PS-X EXE file and extract the MDX data from the EXE using a hex editor (e.g. HxD). The data layout will be a bit different from PS1 memory, so the MDX data will instead be at offset 1D0800. And you are pretty much right about the size, but note that the reserved space for MDX data is 16384 (0x4000) bytes.
by Choro at 12:41 PM EST on January 6, 2021
Thank you for the response once again. I've gotten the tools running on ruby but sadly they crash/dont work with the error

>ruby unMDX.rb
unMDX v0.5

Convert mdx to midi
Write the path and filename and hit enter.

mdx file: hind.mdx
song 1:unMDX.rb:83:in `block (2 levels) in <main>': undefined method `unpack' for nil:NilClass (NoMethodError)
from unMDX.rb:80:in `each'
from unMDX.rb:80:in `block in <main>'
from unMDX.rb:54:in `each'
from unMDX.rb:54:in `<main>'

Is there any way to fix this? I'm pretty sure the MDX data is correct.
by Nisto at 12:59 PM EST on January 6, 2021
Do you have all the files from the GitHub repository? It looks like there are some dependencies needed by unMDX.
by Choro at 1:33 PM EST on January 6, 2021
Alright, I've figured it out. I was dumping them in the wrong endian format which was breaking it. I finally got .mid files out of them. They sound completely broken though, is there any way somehow I could automatically apply all of the .wav instrument files to them? After examining the rb file for a while, it seems that every MGS music command has a hex number; if so.. there must be a instrument one, right? that can be used to set the midi patch then.
by Nisto at 3:47 PM EST on January 6, 2021
It's been a while, but if I recall everything correctly:

There is no global command that sets the current instrument in MGS1. All events in MDX sequences are 4 bytes long. I'll denote the bytes (in raw order) as: B3 B2 B1 B0

If B0 is >= 0x80, then the game interprets the event as a command, and B1/B2/B3 as command parameters.

However, if B0 is < 0x80, then the game interprets the event as a note, B1 as an instrument number (or "voice" number rather), B2 as the note length, and B3 as the note velocity.

MGS1 keeps up to 3 different "banks" (voice tables) in memory. The first one, from the "init" stage WVX (which is always loaded), contains both common instruments and sound effects, so there is a hardcoded index number that indicates which entry is the first musical instrument (in MGS Integral, this is 0x4F). This index is added to the instrument number indicated in note events to get a proper pointer to an entry in the voice tables. The voice entries furthermore point to an address in SPU RAM, which can be used to get an offset to the actual sample data.

edited 4:22 PM EST January 6, 2021

Go to Page 0

Search this thread

Show all threads

Reply to this thread:

User Name Tags:

bold: [b]bold[/b]
italics: [i]italics[/i]
emphasis: [em]emphasis[/em]
underline: [u]underline[/u]
small: [small]small[/small]
Link: [url=http://www.google.com]Link[/url]


HCS Forum Index
Halley's Comet Software
forum source