• For our 10th anniversary on May 9th, 2024, we will be giving out 15 GB of free, off-shore, DMCA-resistant file storage per user, and very possibly, public video hosting! For more details, check a look at our roadmap here.

    Welcome to the edge of the civilized internet! All our official content can be found here. If you have any questions, try our FAQ here or see our video on why this site exists at all!

Linux and My Journey into DOSBox MIDI Hell

Arnox

Master
Staff member
Founder
Messages
5,285
The torture all started with a simple innocent question. "Gee, DOSBox sure runs great, but I'd really like to get the MIDI music working..."

What followed after that was an ordeal that I can only describe as painful and retardedly archaic. Now, the good news is I finally figured out a very easy solution that works amazingly. But it took me, all said and done, SIX STRAIGHT HOURS of banging my head against a brick wall just to get to that final blessed solution.

My first attempt was to see if you could just make the emulated SoundBlaster card output the MIDI music. Well, you can! ... If you want it to sound like shit! So I tried setting the other sound card options for the MIDI music in the game SETUP exe, and unfortunately, none of them worked. Ok, so I did some reading, and apparently you need a separate MIDI synthesizer program and a MIDI soundfont file to get DOSBox to output MIDI to something other than the SoundBlaster. Eww... Kinda clunky but whatever. Maybe I can streamline the process somewhat.

So I get the MIDI synthesizer software. I saw some people recommend Timidity so I get that. Annndddd... How do I even run it? After yet more searching, I find the command, "timidity -iA". Great, it works! Now, where would I get the soundfont file? I saw some recommendations for fluid-soundfont-gm so I get that. Great! How do I get DOSBox to connect with timidity... ? I had no clue. Finally, after yet MORE searching, I find I have to specify a MIDI port or something? Where... ? Ah, in the DOSBox config file... Where? Oh, in "/home/<yourusername>/.dosbox" Ok, but there's no line that talks about a MIDI port. Hm, but it says here that I just need to add a line that says midi device or something! Oh, except that doesn't work at all!

Finally I figure out that the port is usually 128:0 for timidity and that it needs to put after the midiconfig= line in the DOSBox config file. Yeah, that makes sense... I guess??? Whatever. Let's move along. So after all this, I FINALLY get some MIDI music going that isn't the terrible SoundBlaster MIDI. But wait. Oh... Oh, you thought we were done now? You thought this was over?

:risitas:

No.

So first of all, the stereo speaker balance (left vs. right bias) was more biased to the right for some reason. And second of all, it wasn't the original Microsoft Windows MIDI we've all grown to know and love. Sure, it was good, but it wasn't a substitute for the OG music. So I went on a search for that original soundfont file and found... Nothing really. I finally asked around, and finally, one kind soul on Reddit by the name of Hatta00 on /r/abandonware gave me a link to the real OG Windows soundfont. https://musical-artifacts.com/artifacts/713

Yes! So I did a quick search, found out how to make timidity use custom soundfonts, edited the timidity config, and got it running! But uh... I kinda didn't. The MIDI was playing mostly correct but sometimes the pitch was just off. It was weird. The instruments themselves sounded correct though so I thought it was just timidity being dumb and I needed to configure it properly.

I could not configure it properly.

I also set off on figuring out how to make the OS launch the timidity daemon on autostart. No problem I'm sure. Just write a super simple script and make KDE launch it. But oh wait. Ha, ha, ha... There were, uh, problems with that too. Because of course there was. Why not?? Let's pile 'em on. It's fun. Lots of fun! Yes, we have fun here. :) But yeah, turns out you need to explicitly make the .sh script executable in the permissions every time you make one, and in the beginning of the file, it's not "#!/bin/bash" as some write it. It's, "#!/usr/bin/bash". If you don't have that, it won't execute. Why? No freaking idea. But hey, we finally got the service to autostart on login. Yay. Moving on.

I went back to DOSBox, but after fixing the stupid autostart script, I couldn't get any further at all in figuring out why the original Windows soundfont file (already converted for Linux use by the way) was screwing up like this. I even tried another MIDI synthesizer, but I couldn't even get that thing to play music at all. I did find an answer to all of this madness though. Yep. Turns out... You just need to install DOSBox-X from a flatpak, specify the path to the soundfont file in the app options, and it'll work flawlessly afterward.

"Wait," you may ask. "If that's all you had to do, then wouldn't that make all your other work with timidity and the other DOSBox version completely pointle-" Yep. That's right. Six hours of my life completely down the fucking drain. And that's the end of our magnificient adventure. I'm going to bed now. Goodnight.
 
Top