LinuxCommandLibrary

timidity

Play MIDI files using SoundFont instruments

TLDR

Play a MIDI file

$ timidity [path/to/file.mid]
copy

Play a MIDI file in a loop
$ timidity --loop [path/to/file.mid]
copy

Play a MIDI file in a specific key (0 = C major/A minor, -1 = F major/D minor, +1 = G major/E minor, etc.)
$ timidity --force-keysig=[-flats|+sharps] [path/to/file.mid]
copy

Convert a MIDI file to PCM (WAV) audio
$ timidity --output-mode=[w] --output-file=[path/to/file.wav] [path/to/file.mid]
copy

Convert a MIDI file to FLAC audio
$ timidity --output-mode=[F] --output-file=[path/to/file.flac] [path/to/file.mid]
copy

SYNOPSIS

timidity [options]

PARAMETERS

-iA
    Use ALSA as the output driver.

-iO
    Use OSS (Open Sound System) as the output driver.

-Ow
    Output to a WAV file (default: stdout). Use -o to specify the file name.

-Ao
    Output to a AU file (default: stdout). Use -o to specify the file name.

-o
    Specify the output filename for WAV/AU output.

-s
    Specify the sample rate, number of channels, and sample format (e.g., -s 44100,2,16).

-F
    Specify the soundfont file to use.

-v
    Verbose output.

-c
    Specify an alternate configuration file.

DESCRIPTION

The timidity command is a software synthesizer that can play MIDI (Musical Instrument Digital Interface) files on a Linux system. It converts MIDI data into audible sound using soundfonts or other instrument definitions. It supports various output methods, including direct sound card output (OSS, ALSA), and file output (WAV, AU). Timidity is highly configurable, allowing users to customize the soundfont used, sample rate, and other audio parameters. It is primarily used in environments where dedicated MIDI hardware is not available or desired, offering a software-based solution for playing and converting MIDI files. It's important to note that `timidity` itself is often a wrapper script that launches `timidity -iA` (ALSA) or `timidity -iO` (OSS) under the hood, so the actual command being run may vary depending on your system's configuration.

CAVEATS

Timidity's output quality heavily depends on the soundfonts used. Older versions might require specific configuration to work correctly with modern soundcards. Configuration files are sometimes required to configure which midi ports/devices are to be used. Also, proper output configuration (ALSA or OSS) is critical for correct functionality.
Note: Timidity's development appears to have slowed down significantly in recent years.

CONFIGURATION FILES

Timidity uses configuration files (often `timidity.cfg` or a similar name) to specify soundfont locations, MIDI port mappings, and other settings. These files are crucial for customizing Timidity's behavior.

SOUNDFONTS

Soundfonts are collections of audio samples that Timidity uses to generate sound. The quality and variety of available soundfonts greatly impact the final output. Various free and commercial soundfonts are available online. `timidity`'s configuration file must be properly configured to load your soundfont.

HISTORY

Timidity began as a project aimed at providing a software-based MIDI synthesizer for Unix-like systems, particularly Linux, during a time when hardware MIDI synthesizers were less common or affordable. It gained popularity due to its ability to play MIDI files using soundfonts, allowing users to listen to MIDI music without dedicated hardware. Over time, it has seen various updates and improvements to support different output methods (OSS, ALSA) and soundfont formats. While it was once a very common choice for MIDI playback, alternatives like `fluidsynth` have gained prominence.

SEE ALSO

Copied to clipboard