HowTo: Using TiMidity++ to improve your Windows MIDI output

Have questions? Just saying hello? This is the place.
No explicit, hateful, or hurtful language. Nothing illegal.
Nicholas
Posts: 12551

Post by Nicholas »

There is a free software MIDI driver available that may be a significant improvement over your Windows software synth, or even your hardware synth if you have an onboard sound card. It's called TiMidity++ and uses sets of recorded audio samples that can also be found for free. It was originally written for Linux but was conveniently turned into a Windows MIDI driver.

This is a guide to help get it set up and running on your Windows computer using a highly acclaimed free SoundFont called FluidR3. I've only tested this in Windows XP so your mileage may vary on Vista or others.
  1. Go to the Japanese TiMidity++ Windows Synthesizer SourceForge download page and grab "TiMidity-CVS080328_setup_ENG.exe".
  2. Run the installer and proceed past the first couple screens and agreement until you get to the "Choose Components" screen.
  3. Be sure to check the box labeled "Timidity++ Driver". (You can uncheck every other box if you'd like.)
  4. I didn't change the "C:\timidity" folder in case the software had trouble with pathnames containing spaces, but you might be able to put it in Program Files if you're feeling lucky.
  5. During the install, you'll get one of those "This driver is unsigned" prompts. Those are creepy. Click "Continue Anyway".
That's it for the bare minimum. TiMidity++ with the base sample library it comes with is already a big improvement over the built-in Windows synthesizer. In the game you'll have a new output device that you can use.

But, it can get even better. Read on...
  1. Next, you need a sample library. The HammerSound SoundFont Library page contains many free and for-pay sample sets. One of the most highly recommended sound sets is named FluidR3 by Frank Wen. Here is the direct FluidR3 download page at HammerSound. Choose a mirror there and grab all 68 MB.
  2. Extract both the "FluidR3 GM.sfArk" and "FluidR3 GS.sfArk" files from the zip and put them someplace you can work with them.
  3. .sfArk is a compressed SoundFont file format. TiMidity++ can only use the uncompressed .SF2 file format. So, you need a tool that can do the decompression. Get sfArkXTc available on the sfArk SoundFont Compression page and install it.
  4. Drag the start menu shortcut out to your desktop or your working folding (so that you can drag-drop files onto it) and drop each .sfArk file on it, one at a time. This will create an exe for each.
  5. Run the new "FluidR3 GM.sfArk.exe" and "FluidR3 GS.sfArk.exe" applications. Each will decompress into an .SF2 file. (The GM exe will take a while and results in a 141 MB file.)
  6. At this point you can delete the FluidR3 zip, both .sfArk's, and both exe's, leaving just the two .SF2 files. You may also uninstall the sfArk extractor if you wish.
  7. Move both SF2 files to the C:\timidity\ directory (or wherever you installed the driver).
  8. Download the following configuration file attached to this post into C:\timidity\ (If you chose someplace other than the default install directory you'll need to change the first line of the config file in a text editor.)

    [The extension cfg has been deactivated and can no longer be displayed.]

  9. You may need to restart your computer for the MIDI driver to appear in your list of output devices in MIDI-enabled programs.
That should be it. It's quite a few steps, but hopefully it'll be worth it when you see how much better MIDI can sound (for free).

NOTE: In Synthesia, TiMidity can introduce a little bit of lag between you hitting a key and it playing, because it's a software driver and requires a bit more buffer between note input and wave output, but the lag varies across computers. You may or may not have a problem with it.

I was able to make it a little better (at least, I think I did; it's hard to tell...) by opening the twsyng program that it added to my Start Menu. Then, right-clicking the system tray icon it creates, going to "Preferences", the "Synthesizer" tab, and changing the "Compute max time msec" down to a smaller number like 100 ms instead of 500.
moatdd
Synthesia Donor
Posts: 6

Post by moatdd »

I tried downloading sfArkXTc from http://www.melodymachine.com/sfarkxtc.htm, but melodymachine.com seems to be out of commission. I couldn't find any mirrors on Google, either. Would anyone happen to have the installer for sfArkXTc?
Nicholas
Posts: 12551

Post by Nicholas »

Weird, you're right that the "more information" page has broken links. The sfArkXTc download right on the page I linked still seems to work though. Here's a direct link.

If that still doesn't work, I'd be happy to mirror it here.
moatdd
Synthesia Donor
Posts: 6

Post by moatdd »

Ah haaaaaa... I discovered something verrry strange.

http://www.melodymachine.com seems to be broken. However, melodymachine.com works, without the www prefix.

So THIS direct link seems to work... (maybe it's because of where I live)
User avatar
mahen
Synthesia Multiple Donor!
Posts: 73

Post by mahen »

Nicholas,

I currently use Synthesia with Timidity under Linux, thanks to the Wine compatibility layer with no pb (though I cannot really achieve anything considering my current level -- definitely looking forward to the 31st ;)

My question is... What are the settings in the timidity.cfg used for ? Would they also be useful in my case ? Mine is almost empty, as you can see :

/etc/timidity/timidity.conf

Code: Select all

# Instrument configuration file for timidity
# $Id: timidity.cfg,v 1.7 2005/09/03 19:26:03 hmh Exp $

# You can change just about every option in TiMidity++ using
# This config file.  Please refer to the timidity.cfg(5) manpage
# for more details

## If you have a slow CPU, uncomment these:
#opt EFresamp=d         #disable resampling
#opt EFvlpf=d           #disable VLPF
#opt EFreverb=d         #disable reverb
#opt EFchorus=d         #disable chorus
#opt EFdelay=d          #disable delay
#opt anti-alias=d       #disable sample anti-aliasing
#opt EWPVSETOZ          #disable all Midi Controls
#opt p32a               #default to 32 voices with auto reduction
#opt s32kHz             #default sample frequency to 32kHz
#opt fast-decay         #fast decay notes

## If you have a moderate CPU, try these:
#opt EFresamp=l
#opt EFreverb=g,42
#opt EFchorus=s
#opt s32kHz
#opt p64a

# Disabling some of the Midi Controls can help with the CPU usage a lot.
# The same goes to the VLPF, sample anti-aliasing and effects such as
# reverb and chorus

soundfont "/home/mahen/midi/soundfonts/FluidR3 GM.SF2"
#soundfont "/home/mahen/midi/soundfonts/PC51f.sf2"
#soundfont "/home/mahen/midi/soundfonts/AI-APiano02trans.SF2"
#soundfont "/home/mahen/midi/soundfonts/CrisisGeneralMidi3.01.sf2"
#soundfont "/home/mahen/midi/soundfonts/CrisisGeneralMidi1.8.sf2"

# By default, try to use the instrument patches from freepats:

#source /etc/timidity/freepats.cfg
I also have this in /etc/default/timidity (in ubuntu, when the timidity package is installed, it's automatically launched at startup)

Code: Select all

# Defaults for TiMidity++ scripts
# sourced by /etc/init.d/timidity
# installed at /etc/default/timidity by the maintainer scripts
# $Id: timidity.default,v 1.3 2004/08/07 14:33:26 hmh Exp $

#
# This is a POSIX shell fragment
#

# Enable MIDI sequencer (ALSA), default is enabled
# Disable it if you have real MIDI hardware
TIM_ALSASEQ=true

# Setting overrides (of /etc/timidity.conf) for the ALSA sequencer daemon
# TIM_ALSASEQPARAMS="-Os"
TIM_ALSASEQPARAMS="-iA -B2,8 -Os1l -s 44100 -A60 --sequencer-ports=2 --realtime-priority=10"
Running Synthesia from Linux (WINE).
Nicholas
Posts: 12551

Post by Nicholas »

So, your timidity.conf has the important line (actually, it looks like the only line) where it selects the FluidR3 sound font. I wonder if there is a difference between the Windows and Linux version (I know the Windows one was sort of a one-time port and isn't well supported).

It looks like the Windows config file specifies instrument-by-instrument, for each bank, certain properties (amplitude, panning, etc). My guess is those are probably all the default settings (possibly even stored in the SF2 file), so the Linux side just saying "yeah, use this soundfont" might be equivalent.

Outside of that, I can't really offer more help. I remember having trouble getting it working in Windows and through a few hours of troubleshooting and Google searching coming up with that config file. Without it, it didn't work and with it, it did... so I used it. Later, I couldn't find where I first got the config file, so I just attached the one I still had right to this post. (It was clearly a very scientific process. ;) )

Assuming things sound pretty good in your current setup, you're probably alright. But, it might not hurt to dump the contents of the file posted here right at the end of yours. Probably without the first "C:\timidity" line though... and I don't know if you'd need a global find-and-replace of "FluidR3 GM.SF2" to the full path to your file. But yeah, play around with it. I know that when the Fluid R3 font is set up correctly it sounds really nice.
User avatar
mahen
Synthesia Multiple Donor!
Posts: 73

Post by mahen »

Thanks for your reply, again :)

Well, I tried your config file... It definitely *does* sound different, but I'm unable to tell which configuration is better :)
I'll leave yours for the time being ;)

cheers !
Running Synthesia from Linux (WINE).
astaridk
Synthesia Donor
Posts: 1

Post by astaridk »

Hi, im new, and prolly posting in the wrong place :P anyways i tried this guide, setting the output to the timidity driver did not produce any sound, and yet when i play midifiles inside the timidity application it does play it using the correct soundfont... odd...
So stuck with Microsoft GS wavetable thingy.

Wouldnt it be a good idea to add soundfonts+asio support to the game? or is that too extensive?
Nicholas
Posts: 12551

Post by Nicholas »

You're not in the wrong place. ;)

I can understand having trouble getting the TiMidity++ Windows driver to work all the way. It is sort of a hit-or-miss process and it looks like the Windows driver part was already a little spin-off of the actual TiMidity++ project to begin with and may not even be active anymore. It took quite a bit of fiddling before I was able to do it myself, and unfortunately, I don't have any advice outside of double-checking that you did each step word-for-word in the guide. (Though it sounds like you've already done that.)

Still, adding Soundfont support to the game is probably quite a bit outside the scope for now. Whether TiMidity++ is a good solution or not, there are a handful of other virtual MIDI drivers and I'm sure quite a few people prefer to run the game straight through their keyboard all the time. So, I'd probably put Soundfonts and ASIO on a version 2.0 (or later) list and try to take care of some of the more core features first.
nnxion
Synthesia Donor
Posts: 43

Post by nnxion »

You can download newer versions here. Yes, it's in Japanese but you can still see the Setup_EN.exe files... But it's actually the newest version and has a lot of new nice things like a config editor (haven't used it yet), also has an included soundfont (musix).
Nicholas
Posts: 12551

Post by Nicholas »

That's a good find. I didn't know the version that had been turned into a Windows driver was still being maintained. I updated the link in the first post with yours.
Nephiros
Posts: 5

Post by Nephiros »

I followed the instructions on the first post, and I can switch my midi playback on Windows to Timidity just fine (I had to copy the .cfg in my windows folder), but for some reason it doesn't work very well in Synthesia. It seem to only work half of the time, and then it goes mute 10-20 seconds into the songs. What gives?
Nicholas
Posts: 12551

Post by Nicholas »

That's strange. I haven't heard of any other problems with using TiMidity in the game. Is your computer older or lower spec'd? I'm not too familiar with all of the inner workings of TiMidity, so there isn't really much else I could suggest outside of going to their site and asking around there.
Nephiros
Posts: 5

Post by Nephiros »

The only thing I may be somewhat lacking by today's standards is ram, of which I have 1 gb. I guess I don't mind the problem too much for now though, as I'm playing piano-only songs which don't sound so bad compared to other midi instruments (timidity is still much better) and at least I don't have to worry about delay. Thanks for the help anyways, and thanks for making this sweet game!
kiwi
Synthesia Donor
Posts: 1178

Post by kiwi »

well why not try midi yoke?
Majandi
Posts: 1

Post by Majandi »

I wasted a lot of time installing timidity and I can't use it because it has a BIIG delay. I tried the tip of changing the 500ms to a lower value but it didn't work.

So, I'm uninstalling it again xD
Nicholas
Posts: 12551

Post by Nicholas »

Majandi wrote:I wasted a lot of time installing timidity and I can't use it because it has a BIIG delay.
Sorry about that. I guess results are mixed. I think the delay is vaguely related to how fast your computer is, but there are probably lots of things that could still slow it down on top of that.
Phatency
Posts: 22

Post by Phatency »

Personally, I always have propellerheads Reason open in the background, which I have assigned many controls on my keyboard if I want to change the sound while I'm playing. It's funny how it's still noticeably faster than Microsoft GM Wavetable Synth, and the sound has to go through 20 effects until it gets outputted. I wouldn't actually recommend this solution to anyone though.
Zageron
Posts: 84

Post by Zageron »

I'm having an issue setting the sound fonts up correctly.
I'm also getting a very 'fappy' or distorted sound coming from it. This has been happening the entire time (even before the sound fonts). I now get an error from Tmidi saying that it can't read the configuration file.
Bissrok
Posts: 341

Post by Bissrok »

Worked really nicely for me. Didn't have any trouble setting it up or running it, and now it sounds really nice.

Thanks for the tip.
Post Reply