drfrag666 / gzdoom

GZDoom adds an OpenGL renderer to the ZDoom source port.
http://gzdoom.drdteam.org
GNU General Public License v3.0
73 stars 15 forks source link

gus timidity+ and wildmidi emulation fix #33

Closed emawind84 closed 2 years ago

emawind84 commented 2 years ago

Fixes for gus, timidity+ and wildmidi emulation

To properly test the DMXGUS configuration the gus_memsize can be tweaked so the sound will listen differently depending on the memory selected (256 / unlimited sounds way different).

Also to test the midi_config and wildmidi_config is better to remove paths from the section SoundfontSearch.Directories since a valid item is picked from the collection if no value has been set for these options.

A good example of custom DMXGUSC lump with custom patches is the map d2xtreme, where the music will sound quiet different whether you use the lump as configuration or the fallback timidity configuration https://www.doomworld.com/idgames/levels/doom2/d-f/d2xtreme

emawind84 commented 2 years ago

I found the bug inside the class FileSystemSoundFontReader that was preventing patches from getting loaded in GMXGUS mode in the original implementation, I will do some more changes later... The issue is in the method open_file fopen flag used is rt but it should be rb to read binary files.

drfrag666 commented 2 years ago

But is GZDoom also affected? Is it somehow related to this? https://forum.zdoom.org/viewtopic.php?f=104&t=74550&p=1211722 This is not a simple change, i think someone else with MIDI knowledge should look at it, but who? Besides you know that i mostly discontinued LZDoom do you? Anyway fixes are always welcome.

drfrag666 commented 2 years ago

I don't even know how to load the patches, either the ones that came with that wad in GRAVPATS.ZIP or those in EAWPATS.ZIP. I changed the gus_patchdir CVAR. May be they should be in the soundfonts folder i dunno. When i tested GUS both in GZDoom and LZDoom the music sounded bad and different from Timidity++.

emawind84 commented 2 years ago

But is GZDoom also affected? Is it somehow related to this? https://forum.zdoom.org/viewtopic.php?f=104&t=74550&p=1211722 This is not a simple change, i think someone else with MIDI knowledge should look at it, but who? Besides you know that i mostly discontinued LZDoom do you? Anyway fixes are always welcome.

Is not a simple change but it fix the problems with the GUS emulation and also with Wild midi configuration not working as it should. The problems are not related to how the emulation sound itself so I didn't need any knowledge regarding MIDI. GUS emulation was not reading the lump inside doom.wad and doom2.wad, now it does. Also wild midi configuration work with the collection of gus patches if they are found.

I think someone else with MIDI knowledge should look at it, but who?

I used my times to fix these issues and even though I don't have a great knowledge of MIDI I still took the time to research about it before touching the code also because I care about this port and even though this will be discontinued is still the base for the VR port questzdoom that I am currently maintaining.

I read some comments on discord last year regarding these issues affecting also gzdoom but I still need to grab the zmusic source to have a look at it. But since someone else with MIDI knowledge should look at it I really don't know if I want to do it anymore.

emawind84 commented 2 years ago

I don't even know how to load the patches, either the ones that came with that wad in GRAVPATS.ZIP or those in EAWPATS.ZIP. I changed the gus_patchdir CVAR. May be they should be in the soundfonts folder i dunno. When i tested GUS both in GZDoom and LZDoom the music sounded bad and different from Timidity++.

Just put the zip inside the folder soundfonts and they will be listed in the collection of soundfonts, then you can select them in the advanced options, under the option select configuration. GUS patches are supported by GUS, Timidity+ and Wildmidi emulation. Inside the zip (resource file), has to be present the timidity configuration timidity.cfg, this configuration will be used and the right instruments will be loaded accordingly.

You can switch between timidity configuration and lump configuration (DMXGUS lump) in advanced options -> midi player options -> gus emulation -> read dmxgus lumps.

When i tested GUS both in GZDoom and LZDoom the music sounded bad

Thats because it was trying to read the default sf2 configuration file, but it seems like the gus emulation (old timidity) wasn't finished and so the implementation is lacking support for sf2 files, so I just removed them from the list. I don't think people would use gus emulation with sf2 files anyway, there are already Timidity++ and fluidsynth that work way better with these files.

emawind84 commented 2 years ago

I think someone else with MIDI knowledge should look at it, but who?

Frankly I think your answer show a little lack of consideration since I might know about MIDI without having to tell the whole Internet about it and getting your reply after I worked hard at fixing these problems it doesn't feel good I can tell you. If I told you that I fixed these problems why someone else should look at it in the first place?

drfrag666 commented 2 years ago

No, i mean someone else than me to review the PR. I will try to load the patches.

emawind84 commented 2 years ago

Some musics sound way different when changing the gus memory, you can try the map E2M1 and play with the gus memory when using the lump configuration (it doesn't work with timidity.cfg) and you will notice different use of instruments.