Sunday, May 16, 2010

Timidity and DOSBox in Ubuntu 10.04

For those of you who care about this sort of thing, here's how I finally got decent General MIDI playback for DOSBox in Ubuntu 10.04:

(These instructions are somewhat adapted from a post by Malor on the official Ubuntu forums)

1. Go into Synaptic Package Manager and install these packages:
  • dosbox
  • timidity
  • fluid-soundfont-gm
  • fluid-soundfont-gs
2. Open a command prompt, and type:
sudo gedit /etc/timidity/timidity.cfg
  • The last line in the file says:
    source /etc/timidity/freepats.cfg
    Put a # mark at the beginning of that line to comment it out. We're going to use the soundfonts we installed from the previous step.

  • On the next line, type:
    soundfont /usr/share/sounds/sf2/FluidR3_GM.sf2
  • Save and exit
3. If you don't already have a dosbox.conf you want to use, type:
and hit enter. Dosbox will pop up. At its command prompt, type:
config -writeconf dosbox.conf
This will generate one for you. Then type:
to quit dosbox.

4. Type
gedit dosbox.conf
  • Click the Find button, type:
    and click Find. You should see a line highlighted.
  • Close the search popup.
  • The three lines starting with mpu401= should look like this:
  • Save and exit
5. Restart Ubuntu
6. Open a command prompt, type:
timidity -iA -B2,8 -Os -EFreverb=0 2>&1 &
7. Start dosbox
8. Enjoy General MIDI. :)
9. Close terminal window when finished.

Note: You may have to occasionally change
in your dosbox.conf. Watch the output when you start timidity and it'll show which to use.

Also, if you get permission errors while installing or running timidity, you may have to add "timidity" to the "audio", "pulse", and "pulse-access" groups in Users and Groups (In the System menu).


Andrew Swan said...

Yes, I do notice the messy formatting. I'll try to fix it later.

Zalewa said...

Works like charm even without the "timidity -iA -B2,8 -Os -EFreverb=0 2>&1 &" line.

However this method requires the game's setup to support "General MIDI" output device. If anything else is set (like Sound Blaster) I get the same bad quality as usual. Unfortunately some games don't support "General MIDI" (Dungeon Master 2) or even don't allow to use a separate MIDI device (Celtic Tales: Balor of the Evil Eye).

Is there any way to work around this problem?

Andrew Swan said...

I should have mentioned that. You do need a game that supports General MIDI, and isn't locked into expecting it on a non-standard address. You can try to use the Roland stuff (MT-32, etc.), but the instruments are usually mapped differently than on "standard" General MIDI. Your next best bet is Gravis Ultrasound support, although you will have to install Ultrasound drivers in DOSBox as if for DOS. I should note that it will then use the default Gravis Ultrasound sounds, since it's emulating the way the Ultrasound works in DOS, not just sending signals to an outside program like with the General MIDI emulation.

juanca77 said...

There is a problem with this:

I have a 7.1 speaker system, but MIDI works only with 2 speakers (digital sound works in all speakers)

Andrew Swan said...

Hmmm. That's a bit beyond my expertise and equiptment (I just have two speakers), but you should try posting in the appropriate section on (search for your issue there first, of course. :) )

Unknown said...


I've tried to get sound with your tutorial, but it shows following error:

MIXER:Can't open audio: No available audio device , running in nosound mode.
ALSA:Client initialised [129:0]
MIDI:Opened device:alsa

Ubuntu 10.04/64Bit DOSBox 0.73

Andrew Swan said...

Huh. Has your sound stopped working overall, or just in DOSBox?

Shar Qaan said...

Thanks, Bro, for posting this howto which I've needed on multiple occasions

Andrew Swan said...

Glad it helped. :)

Oh, and just FYI: for some reason your comment was received six times. Not sure why, but I though you might like to know.

Unknown said...

It only says intelligent, not alsa or the other one for config.

Andrew Swan said...

You could try adding the additional options to the config file manually and see if it works.

If you get no MIDI sound, you might also want to check out this forum thread for other potential issues:

Good luck, and I hope you get it working.

Jeff said...

Worked perfectly here. Thank you!

Which deinterlacing algorithm is the best? Part 1 - HD interlaced footage

Before I began, I'd like to give a special thanks to Aleksander Kozak for his help in testing and providing the HD footage used in this ...