Kjetil's Information Center: A Blog About My Projects

OpenTTD music files in other formats.

OpenTTD is a multi-platform clone of the classic game Transport Tycoon.

Normally, the original midi files are used, and requires a midi player to play the music. The default midi player is "timidity", which produces excellent sound, but seems to use a lot of CPU, so I want to use something else.

It is actually possible to use other formats (and players) than midi, due to the way the music system is currently implemented in OpenTTD. When a music track is started; OpenTTD fork()s and starts the music player as a separate process with the music filename as an argument.

I have successfully managed to use "ogg123" (part of the vorbis-tools package from xiph.org) to play the music files, by converting all the midi files to Ogg Vorbis format and perform a single configuration change. In the configuration file "openttd.cfg", there is a section named "[music]", where a option named "extmidi" resides. Simply change the option value to "ogg123" or the name of the player you want to use. When converting the midi files to a different format, make sure the filenames of the new files are exactly the same as the old ones.

I tested this with OpenTTD version 0.5.3 under Linux.

Topic: Configuration, by Kjetil @ 31/12-2007, Article Link