Skip to content

Instantly share code, notes, and snippets.

@rdlu
Last active March 16, 2017 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdlu/389bd6414771ba014151824344babeaf to your computer and use it in GitHub Desktop.
Save rdlu/389bd6414771ba014151824344babeaf to your computer and use it in GitHub Desktop.
Running Timidity + Munt + Dosbox
#!/bin/bash
timidity -iA &
mt32emu-qt &
sleep 1s
timidity_port=$(aconnect -ol | grep TiMidity | head -1 | awk '{print $2}')0
munt_port=$(aconnect -ol | grep Munt | head -1 | awk '{print $2}')0
dosbox -c "set timidity=$timidity_port" -c "set munt=$munt_port"
kill %1 %2
###
# Tips
###
#CONFIGURE DOSBOX TO USE MUNT
#Once MUNT is up and running, you will need to configure dosbox to use MUNT for MIDI. As with any other dosbox configurations, you will accomplish this by editing the dosbox.conf file. This file is usually located in the .dosbox dir within your home directory. On later versions of dosbox, this file is actually named something like dosbox-0.73.conf, where 0.73 will be replaced with whatever your dosbox version happens to be.
#Once you have the dosbox configuration file open, you need to check for two things. First, search for the line that says “mpu401=” and make sure that it is set to “intelligent”. Most games supporting the MT-32 require an MPU-401 to be running in intelligent mode. This is the default for dosbox now days, but it never hurts to double check.
#This next part is critical. Move down two lines to the option labeled “midiconfig=” and set it to equal “128:0”. The 128 is the ALSA client number and the 0 is the port number for that client.
#Save your dosbox config file and exit your text editor. You are now ready to run dosbox.
#IMPORTANT NOTE
#Depending on your setup, the ALSA client and port numbers maybe different, but unless you have another software synth running (which is NOT recommended) it will be 128:0.
#You can check MUNT's ALSA client and port numbers by running one of the following two command while MUNT is running:
#
#$ aconnect -o (that's a lowercase letter "o" not a zero)
#or
#$ cat /proc/asound/seq/clients
#
#Somewhere in the output you should see something that looks like this:
#Client 128 : "MT-32" [User]
# Port 0 : "Standard" (-We-)
# Port 1 : "GM Emulation" (-We-)
#
#We see that MUNT (labeled here as “MT-32”) is registered as client number 128 and it has two ports open, port 0 and port 1.
#For true MT-32 emulation, always use port 0. Port 1 is only used when you want MUNT to try and translate General MIDI data to MT-32 data. This GM to MT-32 option is experimental and not something you would generally want to do anyway. If your game was designed for General MIDI it will sound better with real General MIDI. For GM games stay away from MUNT and use something like Timidity++ along with a high quality General MIDI soundfont such as 8MBGMSFX.SF2 or FluidR3_GM.SF2.
#When running MUNT please make sure that no other software synth (such as Timidity) is running at the same time. Technically it would be possible to run MUNT along side another soft synth, but this would likely strain your systems resources and complicate setup. Besides, dosbox (and your game) will only use one or the other so there is no reason to try and run two synths simultaneously.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment