TiMidity++

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.
Some of the information in this article may have drifted out of sync with current practices. Please help out by checking over the content (how to get started).

TiMidity++ is a software synthesizer that can interpret MIDI information,

Installation

Note
If TiMidity++ is to be used as a virtual MIDI instrument, see also the MIDI controller guide.

USE flags

USE flags for media-sound/timidity++ Handy MIDI to WAV converter with OSS and ALSA output support

X Add support for X11
Xaw3d Add support for the 3d athena widget set
alsa Add support for media-libs/alsa-lib (Advanced Linux Sound Architecture)
ao Use libao audio output library for sound playback
emacs Add support for GNU Emacs
flac Add support for FLAC: Free Lossless Audio Codec
gtk Add support for x11-libs/gtk+ (The GIMP Toolkit)
jack Add support for the JACK Audio Connection Kit
motif Add support for the Motif toolkit
nas Add support for network audio sound
ncurses Add ncurses support (console display library)
ogg Add support for the Ogg container format (commonly used by Vorbis, Theora and flac)
oss Add support for OSS (Open Sound System)
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
slang Add support for the slang text display library (it's like ncurses, but different)
speex Add support for the speex audio codec (used for speech)
tk Add support for Tk GUI toolkit
vorbis Add support for the OggVorbis audio codec

Emerge

Emerge media-sound/timidity++:

root #emerge --ask media-sound/timidity++

Optionally, install media-sound/fluid-soundfont:

root #emerge --ask media-sound/fluid-soundfont

Configuration

Available patchsets can be queried using eselect:

user $eselect timidity list
Available TiMidity++ patchsets:
  [1]   fluid-soundfont
  [2]   freepats

As an example, to set the fluid-soundfont as the default patchset for the current user:

user $eselect timidity set 1

Starting the daemon

The TiMidity++ daemon can be run in user mode and need not be a system service:

user $timidity -iAD -Os

Timidity can be used with the JACK audio server. It must be started by the same user that is running JACK, e.g.:

user $timidity -iA -B2,8 -Oj -EFreverb=0 -s 48000

Usage

Convert a MIDI file to mp3

TiMidity++ can be used to "play" a MIDI file to stdout, which can be piped to ffmpeg (install if necessary) to create an mp3 file.

On the command line, run:

user $timidity -Ow -o - <file_to_convert.mid> | ffmpeg -i - <output_file.mp3>

This should create a new .mp3 file.

The -Ow option to timidity specifies that output should be in WAV format, the -o - specifies the output should be sent to stdout. The -i - switch for ffmpeg makes it take input from stdin.

Troubleshooting

Pulseaudio

Unfortunately TiMidity++ has difficulties with PulseAudio.

Two possibilities to overcome the situation:

  1. Remove media-sound/pulseaudio and disable PulseAudio support if installed, by removing the pulseaudio use flag from the system configuration
  2. Emerge media-sound/timidity++ with Libao support by activating the ao use flag then run TiMidity++ with -Oo

Sound output monopolized by TiMidity++

Even with PulseAudio removed, sound may be blocked when TiMidity++ is run as a system service. The solution seems to be that some soundcards require a dmix parameter in /etc/asound.conf:

FILE /etc/asound.conf
defaults.pcm.dmix.rate 48000

See also