scummc icon indicating copy to clipboard operation
scummc copied to clipboard

Instructions on how to create/add music

Open Happy-Ferret opened this issue 5 years ago • 3 comments

I'd appreciate a short tutorial on how to create/add midi music to a ScummC game. For testing purposes I took a midi file of the Secret of Monkey Island main theme, dropped it next to the soun tool and ran soun -midi MainTheme.midi, then renamed output.soun, dropped it into examples/openquest and added the following two lines to officeroom.scc

startMusic(themeMusic);

The startMusic bit I added directly inside if(firstInit).

Expected result: Having music play in the background. Actual result: The game crashes.

Happy-Ferret avatar May 05 '19 17:05 Happy-Ferret

I ended up getting this somehow to work (although it still sounds godawful), after realizing I was supposed to merge all tracks into one.

However, there are still instances of the engine crashing after specific control sequences.

../../build.Mark-PC/x86_64-gnu-gcc-5.4.0-debug/midi music/gsmonkey.mid sounds/test.mid -merge-track 2 -merge-track 1 -merge-track 0 -merge-track 3 -merge-track 4 -merge-track 5 -merge-track 6 -merge-track 7 -merge-track 8 -merge-track 9 -merge-track 10 -merge-track 11 -merge-track 12 -merge-track 13 -merge-track 14 -merge-track 15 -merge-track 16 -set-type 0

For instance, the Monkey Island 2 theme song immediately crashes ScummVM.

EDIT: NVM. Turns out when websites advertise the MIDIs as "ripped" they mean as in recorded off of an MT-32 or the likes.

I went ahead and ripped the MIDI straight from the actual game files. The originals work fine alas can't be loaded by my MIDI editor. Well. Can't have it all...

Happy-Ferret avatar May 08 '19 18:05 Happy-Ferret

Hello @Happy-Ferret, I'm currently working to make a soundtrack for "Open Quest", in order to experience myself with iMuse implementation. I'm experiencing the same crash issue :'( ... I wondering if you tried with a MIDIFile directly extracted from MI2 resources, or a file downloaded on the Internet ?

I think system is waiting for some specific SysEX commands into the MIDIFile in order to play propely.

In addition, MIDI File has to be in "2" format : http://www.music.mcgill.ca/~ich/classes/mumt306/StandardMIDIfileformat.html#BM2_2 I've got a little translator program at studio to merge several MIDI "0" files into an unique MIDI "2" ... I'll test it asap !

Wavestation avatar Feb 20 '21 11:02 Wavestation

I progressed in my investigations ... here is a summary of my operations. I did all on a Macintosh under OS 10.11.

  1. I composed a short MIDI tune with my favorite sequencer (aka Digital Performer from Mark of the Unicorn) and exported it as MIDIFIle 0 named "LOBBY0.MID"
  2. I converted this file using a DOS utility called "MIDI0TO2" into a DOSBox session, to a file "LOBBY2.MID"
  3. I used the 'soun' tool included in the package to put my MIDIFile into a .soun resource fork with this command : soun -gmd LOBBY2.MID -o lobby.soun
  4. I used the same code than yours to play the music.
  5. It PARTIALLY worked ... the game doesn't crashes, and the sequence plays ... but ONLY the drum track is audible. I guess I have to deal with control changes (volume, expression, etc.) or other things to make it more "musical". Addendum : To make the tune looping correctly, I think I have to deal with iMuse SysEx hook messages, but I'll try it in a further experience !

Wavestation avatar Feb 20 '21 20:02 Wavestation