Chip's Technical Blog

Tech commentary of thoughts, challenges, how-to's, and the mundane.

Midi on Linux

So one challenge of using Linux is trying to play Midi files. For those from the windows world, this is not an issue. There are a variety of players which play midi files right out of the box, such as Winamp or Quicktime. These can typically either use built-in hardware for playing midis (either external midi devices or a sound card with built-in midi players), or they can use internal patch sets to play the files synthetically.

On Linux, the first of these cases just works out of the box. If you have sound-card-hardware, it generally just works after you enable the sequencing kernel modules. But if you are unfortunate enough to not have such hardware (and let’s face it, the vast majority of computers don’t come with midi hardware since many users don’t listen to them), it won’t work out of the box.

The good news is that there are a few pieces of software out there which can install fake “midi hardware” so that all software can use it out of the box. One of these is TiMidity++, which I had used before without issue. But when I installed it this time around, it had very mixed results. I would play files, and sometimes hear nothing, sometimes hear stuff, and sometimes I would hear only parts of what I expected to hear. Looking into this, I eventually tracked it down to the free patch set which is available as a Linux package. As it turns out, the free patch set only contains a subset of the midi voices, and so as a result, there is silence when playing voices that are missing.

So there are two main issues here with addressing. First, why are there only a subset of voices? And second, what can be done to deal with the missing ones?

  1. The first one is fairly simple, though unfortunate. It’s basically an issue of copyright. The patches which used to be distributed were owned by someone else, and so for legal reasons were removed from the distribution. This is part of a much bigger issue in open source software, which has to do with the ownership of content. As it turns out often the software itself is easy to write (easy being a relative term), but filling it with content people want is hard – legally, because the content producers want to be properly paid for their content. Another example is TV listing data. MythTV users have long gotten their listing data thanks to the generosity of zap2it. But more recently, they’ve decided they can no longer financially continue this service, and there is no where else to get the data. So imagine Tivo, but without the ability look at on-screen listings, or to be able to record a series of a TV show without scheduling it tediously. MythTV would suffer a similar fate. Without the content, TV listing data in this case, the software itself is must less useful. Thankfully, there is a new company Schedules Direct, which hopes to provide a solution to us for this problem, perhaps through a paid service.
  2. The second one is similarly simple, once I knew the problem. There is a “default” syntax, which allows you to define a default patch in case there is one missing. In my case, I prefer to set this to the grand piano. In my /etc/timidity/timidity.cfg, I simply add this line: default Tone_000/000_Acoustic_Grand_Piano.pat And now, I hear all the voices at least, though some of them are being sounded as a grand piano. Now — if I could just figure out how to create patches. One of the missing ones is “Choir Aahs”. Seems like it wouldn’t be hard to collect some samples of Choir Aahs.

Leave a Reply

Chip's Technical Blog is proudly powered by WordPress
Entries (RSS) and Comments (RSS).