timidity
Play MIDI files using SoundFont instruments
TLDR
Play a MIDI file
Play a MIDI file in a loop
Play a MIDI file in a specific key (0 = C major/A minor, -1 = F major/D minor, +1 = G major/E minor, etc.)
Convert a MIDI file to PCM (WAV) audio
Convert a MIDI file to FLAC audio
SYNOPSIS
timidity [options] MIDI_file(s)
PARAMETERS
-A
Sets the amplification level for playback.
-o
Writes the synthesized audio to a file (e.g., WAV) instead of playing it live. filetype can be 'wav', 'aiff', 'au', etc.
-s
Sets the sampling frequency for the output audio (e.g., 44100 for CD quality).
-B
Sets the size of the output audio buffer in milliseconds. Larger buffers can reduce glitches but increase latency.
-i
Specifies the user interface or output driver to use (e.g., 'a' for ALSA, 'c' for curses, 'w' for WAV file output).
-p
Connects to a specific ALSA sequencer port for real-time MIDI input.
-q
Sets the resampling quality. Higher values provide better sound but use more CPU.
-S
Specifies an additional soundfont file to load. Can be used multiple times.
-U
Sets the master volume for playback (0-127).
-F
Specifies an alternative configuration file to use instead of the default.
-h, --help
Displays a help message and exits.
-v, --version
Displays version information and exits.
DESCRIPTION
timidity is a powerful and versatile software synthesizer that can play MIDI files without requiring a dedicated hardware MIDI device. It achieves this by synthesizing audio waveforms from digital instrument "patches" (soundfonts), which typically follow the Gravis UltraSound format. It can play MIDI files in real-time through various audio devices (like ALSA, OSS), or convert them into standard audio formats such as WAV, AIFF, or Au files, making it useful for creating audio tracks from MIDI compositions.
Beyond simple playback, timidity offers extensive customization options, allowing users to control aspects like amplification, sampling frequency, buffer size, and the quality of resampling. It's an indispensable tool for musicians, developers, and anyone needing robust MIDI playback or conversion capabilities on a Linux system, especially in environments where hardware MIDI synthesizers are unavailable or inconvenient.
CAVEATS
Proper operation requires soundfont files to be installed and correctly configured in the timidity configuration file (e.g., /etc/timidity/timidity.cfg). Without soundfonts, timidity will not produce audible output.
Real-time playback performance can be demanding on system resources, especially with high sampling frequencies or complex MIDI files. The quality of synthesized audio is highly dependent on the quality of the loaded soundfonts.
CONFIGURATION FILES
timidity typically uses a global configuration file, often located at /etc/timidity/timidity.cfg or /etc/timidity.cfg. This file specifies the default soundfonts, their locations, and other playback parameters. Users can override these settings using command-line options or by specifying a personal configuration file.
SOUNDFONTS
timidity relies on soundfonts (e.g., .sf2, .pat files) which contain samples of musical instruments. The quality and variety of these soundfonts directly impact the realism and richness of the synthesized audio. Many high-quality soundfonts are available for download online and are essential for optimal timidity performance.
HISTORY
timidity originated from an earlier program called playmidi by Tuomas J. Lukka in the early 1990s. It was later significantly rewritten and enhanced, becoming timidity++. It has been a cornerstone for MIDI playback on Unix-like systems, particularly Linux, providing a robust and flexible software-based alternative to hardware MIDI synthesizers. Its development has focused on improving audio quality, performance, and compatibility with various audio backends and MIDI standards.
SEE ALSO
aplay(1), fluidsynth(1), aconnect(1)