Opened 16 months ago

Closed 16 months ago

Last modified 9 months ago

#14527 closed patch (fixed)

Midi dump feature not working with command line startup

Reported by: fabianostermann Owned by: fabianostermann
Priority: low Component: Audio
Version: Keywords: MidiDriver Midi Dump Feature
Cc: fabianostermann Game: Monkey Island 2

Description (last modified by fabianostermann)

Hi all,

has anyone ever used the --midi-dump feature, that is build in since commit 3b4810a to the MidiDriver from audio/mididrv.h+cpp?

I tested it with stable version 2.7.0, an up-to-date build from source and checked out the code to the state of the former commit 3b4810a in order to detect if it is an error that has occured while improving on the engine or if the error maybe is due to my setup.

Alle three attempts failed leading to no file dump.mid was generated.
When I forced a midi file to be written by code change, it gave me a midi file with header only. So, midi events are never recorded (proved it with debug prints) and the dump cache remains empty.

I tested on my version of monkey1 and monkey2.
Monkey2 directory has following files:

ADLIB.IMS MONKEY2.001 ROL_330.IMS ROL_334.IMS ROLAND.IMS SPEAKER.IMS
MONKEY2.000 MONKEY2.EXE ROL_332.IMS ROL_336.IMS SOUNBLAS.IMS

It's the same if I use only the two main game files MONKEY2.000+1. Music is present when run with the engine.

Can anyone help to find the problem? Is it maybe the version of my game, that is not capable?

I am trying to analyse the iMuse engine for academic research, so having the ability to dump midis and, in the best case, redirect events directly from source code to other programs would really help me.
Rebuilding the iMuse engine in python would be the next thing I would check, if this approach with ScummVM does not work. So if anyone has ideas here, that would also be super helpful for me.

I would appreciate it a lot if someone can provide me any hint of where to look next. Thanks in advance!

(And many thanks for all the work anyone has spend on ScummVM. I use it for playing my favorite adventure for over 15 years now. :-D )

--- Added later:

I got a trace. It seems to have something to do with alsa under linux.
I got it to work by changing the driver settings in the GUI.
Since I need command line startup, I will investigate that further by testing out some config files and report my solution by tommorow.

-- Next step:
Creating the dump.mid file works now. I had to choose alsa as music_driver under linux. This can be set via command line by forcing a specifig config with --config=<file> and setting music_driver=alsa.
This creates a dump.mid file, but music cannot be listened to.
For listening, music_driver=alsa_TiMidity can be used, the a server must be started: timidity -iA.
Third option, set music_driver=fluidsynth and soundfont=<anyfont>.sf3.

Next big problem: By doing as described, no instrument change is produced, so only piano is played back. (At least this is the case for Ubuntu 20.04, which I work with on my laptop. Could have sworn it had worked on Ubuntu 22.04, when I tried it a few hours ago back in my office. More testing tomorrow!

-- Solution
Everything is working now. Because I loaded a save file from woodtick, that went in when the music had already started, the program changes (instrument changes) were not send to timidity/alsa/whatever.
When the savefile is created correctly (just earlier) or the game is played from the beginning, everything works fine.

I will now close this ticket and report the --dump-midi feature working properly! (under linux)

Change History (7)

comment:1 by fabianostermann, 16 months ago

Description: modified (diff)

comment:2 by fabianostermann, 16 months ago

Description: modified (diff)
Priority: normallow

comment:3 by AndywinXp, 16 months ago

Unfortunately I personally wouldn't know how to help for this particular issue, but I'd really like to know more about the research task you're currently conducting!

comment:4 by fabianostermann, 16 months ago

Description: modified (diff)
Type: defectpatch

in reply to:  3 comment:5 by fabianostermann, 16 months ago

Replying to AndywinXp:

Unfortunately I personally wouldn't know how to help for this particular issue, but I'd really like to know more about the research task you're currently conducting!

Hey, I'm happy to hear of your interest.

Nutshell: I'm working on the use of "AI" for adaptive game music. So, the little study I came up with intends to examine under which conditions and with what effort a model can "learn" to reproduce the location-dependent music of Woodtick.

Feel free to contact me, if you have ideas, suggestions or just any thoughts to share!

comment:6 by fabianostermann, 16 months ago

Description: modified (diff)
Owner: set to fabianostermann
Resolution: fixed
Status: newclosed
Summary: Midi dump feature not workingMidi dump feature not working with command line startup

comment:7 by fabianostermann, 9 months ago

Last update: I managed to have everything working as planned. I conducted a little study on AI reproduction of the music, study and results were published here:
https://doi.org/10.5445/KSP/1000162754 (it's in english!)

The corresponding GitHub repo, which is a hacky modification of ScummVM, can be found here:
https://github.com/fabianostermann/WoodtickWalkingSimulator

This code project is well documented and enables to let Guybrush walk through Woodtick following a random path. So maybe, if you just want to listen to the beautiful music of Woodtick and all of its variations, you can also use that tool for that! ;-)

Note: See TracTickets for help on using tickets.