View Full Version : Creating a MIDI SOUN resource for SCUMM V5
07-27-2010, 05:38 PM
I'm trying to create a new SOUN resource with the ROL signature. I wrote a tool which creates the expected header for a MIDI file. The problem I encounter with MIDI files other than those extracted with Scumm Revisited is, ScummVM plays them like expected, but the native SCUMM exe does not. There is just nothing on the MIDI port at all.
I'm not even trying to do neat iMuse tricks or such. Just playing a single track/multi channel MIDI with startSound()
If you like to try for yourself, here is the tool: mid2rol.exe (http://www.rapidspread.com/file.jsp?id=hadxlpmvyt)
It takes one parameter, which is the name of a single-track-MIDI-file. The output file is named 000_ROL.dmp and it is always mode 2, like all SCUMM MIDI files.
07-29-2010, 04:00 AM
If you extract a song from the game (e.g. 000_ROL.dmp), and strip out the non-MIDI data (the ROL header data) using e.g. a hex editor, then use your mid2rol tool, does the resulting file work in a native SCUMM exe?
Maybe the format of the MIDI files is a different version of the file format than whatever the original SCUMM interpreter supports. I assume ScummVM's MIDI handling would be more forgiving/up to date. Just guessing, though.
07-29-2010, 09:37 AM
Well, I figured out a few things. Two requirements are very strict for native SCUMM (but not required by ScummVM):
- The iMuse SysEx f0 7d 00... is used to allocate channels (well documented in the ScummVM source), and is mandatory.
- While MIDI specs allow multiple parameter sets after a single event code, SCUMM requires the event code to be repeated before each parameter set.
Furthermore (also thanks to well documented ScummVM source):
- iMuse SysEx f0 7d 30... can be used for looping.
- The time division parameter seems to be ignored. Apparently, native SCUMM is hardcoded to always use 01 e0 for this, just like ScummVM does. Thus I had to modify the tempo to match this value.
I also tried to add General MIDI support, but my SoundCanvas doesn't receive any program change events. I guess, this is done with the MT-32 specific SysEx.
If you extract a song from the game (e.g. 000_ROL.dmp), and strip out the non-MIDI data (the ROL header data) using e.g. a hex editor, then use your mid2rol tool, does the resulting file work in a native SCUMM exe?It does, it produces a bit identical copy after all.
Btw, Scumm Revisited has a save .mid button, which automatically strips the ROL header. No need to hex edit it out.
07-29-2010, 11:47 PM
I don't know any more off-hand, all I can suggest is checking out the ScummC documentation on iMUSE, since it lists some of the SysEx commands used in SCUMM V6. Unfortunately, the ScummC site seems to be down, the best link I can provide is the one below, which may not have the latest info:
(As an aside, would you mind adding your discoveries to the ScummVM wiki? That way other people can build on your work, and there's less chance of the info disappearing like the ScummC pages.
I'd suggest putting it either in the "Sound Resources" page, or creating a new one for iMUSE stuff)
07-30-2010, 02:53 PM
I managed to add General MIDI support to V5! I just took the GMIDI.IMS from the Sam & Max WIP demo. Thanks to the redundancy of ROLAND.IMS and ROL_330.IMS, I don't even have to sacrifice anything. I hex edited the exe to refer GMIDI.IMS instead of ROLAND.IMS, and it works flawless on my SoundCanvas.
So adding General MIDI support to V5 games is very possible.
vBulletin®, Copyright ©2000-2015, Jelsoft Enterprises Ltd.