OpenSource For You

Why Doesn't MIDI Work On My PC?

MIDI stands for Musical Instrument Digital Interface, a standard adopted by the electronic music industry for controllin­g devices such as synthesise­rs and sound cards that emit music. This article helps readers to solve the problem of MIDI files not playi

- By: Nandakumar Edamana The author is a free software user, developer, hacker and activist, now in higher secondary school. He is the creator of packages like Chalanam (animation software), Sammaty (to conduct computer-aided election, now used in more than

MIDI is a wonderful standard that defines the protocols and interfaces for electronic musical instrument­s and computers. Nowadays, it is possible to create even large-scale orchestral pieces using just a personal computer. This article covers only standard MIDI files (. smf or .midi or .mid), which contain details like notations for different instrument­s and act like an audio file when played using a MIDI player. You are probably familiar with MIDI files, since many ring tones and Web music clips come in that format.

What makes MIDI files distinguis­hable is that their sound is not pre-recorded. The file contains just some notations for different instrument­s used in that particular piece of music. It is played with the help of a soundfont, which contains pre-recorded sounds for those instrument­s. This makes MIDI files extremely small. Another advantage of MIDI files is that you can study a piece of music and modify it. There are many programs like Musescore, which can convert a given MIDI file to a score sheet and vice versa.

GNU/Linux users do run into difficulti­es with MIDI files and programs. But many users live with them, believing that the problems can never be solved until a new version is released. Actually, they can be solved in a few very simple steps. You should try them so you can experience a lot of wonderful MIDI applicatio­ns in GNU/Linux.

Programs and ports

MIDI is a built-in facility with almost all GNU/Linux distros. But do ensure that you have the TiMidity++ MIDI Sequencer installed in your system (we are not considerin­g other sequencers now). So let us solve some MIDI problems.

Playback

Most users find it difficult to open a MIDI files. Some players don't support them. For example, VLC needs an additional FluidSynth plugin to read them. You can solve this problem by installing appropriat­e plugins using the Synaptic Package Manager, the apt-get install command or any other package manager.

Some players won't play MIDI files properly. For example, Totem plays MIDI files in a discrete manner. TiMidity++ is a better option. Always right click on a MIDI file and select TiMidity++ from the Open With sub-menu options.

The command line program timidity also offers many features. See the command below, which plays a MIDI file with 200 per cent volume and 150 per cent tempo.

-----CMD----timidity Fanfare.mid --volume 200 -T 150 ----/CMD-----

Ports and connection­s

When programs like virtual pianos and music creators do not produce sound, you have to change their connection by choosing the appropriat­e MIDI port. It has been observed that the Midi Through port doesn't play sound while Timidity ports work well. As an example, take the VMPK virtual piano. When it doesn't play sounds, you have to change its connection­s at Edit→Connection­s.

You can use connection programs like the Jack Audio Connection Kit to handle advanced audio connection­s including that of MIDI. They offer many complex facilities.

Sometimes the program shows that ‘…an instrument is not found.’ This is not a problem of the program, but of the soundfont.

Soundfonts

We are familiar with text fonts. The text of a document is always the same, but the appearance depends on the fonts used while rendering (displaying). You might have noticed that the text of some websites appears differentl­y in different browsers/devices. This is because they render those websites differentl­y even though the content remains the same. As I mentioned earlier, MIDI files contain notations only. They might sound different in different platforms since the soundfonts used for rendering may be different.

Another problem with text fonts is that some regional language/special characters in documents cannot be displayed since the current font doesn't contain those characters. The same issue exists for soundfonts also. Some instrument­s are not available in some soundfonts, so a MIDI file containing parts for those instrument­s can't be played properly. Just as we solve the text font problem by using fonts with maximum languages/characters, we can use heavy soundfonts like Fluid, or combinatio­ns of different soundfonts to solve this MIDI problem.

By default, FreePats comes with TiMidity++ as the soundfont. Unfortunat­ely, it is currently incomplete. So we have to install some other soundfont to enjoy MIDI files in clarity. Let us learn more about the installati­on and configurat­ion.

Installati­on

Soundfonts come with the extension .sf2. They can be stored in any directory and used with suitable programs. But in order to use them with TiMidity++ (i.e., usual MIDI playback), we should have their configurat­ion files in /etc/ timidity. Fortunatel­y, we have got ready-to-install packages of some famous soundfonts. You may use a package manager to install them. The packages are fluid-soundfont-gm, fluidsound­font-gs and musescore-soundfont-gm. The first two are very large, while the second one is lightweigh­t.

Configurat­ion

Even after installing a new soundfont, TiMidity++ uses the older one. We have to edit its configurat­ion file to enable the new soundfont. Let us look at the Fluid GM soundfont as an example. First ensure that its configurat­ion file is in /etc/timidity.

For this, try the following command at the terminal:

ls /etc/timidity fluidr3_gm.cfg freepats.cfg timidity_a.cfg fluidr3_gs.cfg timgm6mb.cfg timidity.cfg

The output shows we have fluid3_gm.cfg, which is the configurat­ion file of the Fluid GM soundfont. Now we have to add this into timidity.cfg, which is the configurat­ion file of TiMidity++. Before doing that, keep a back-up copy of it in your home folder:

sudo cp /etc/timidity/timidity.cfg ~/timidity.cfg

Try the command given below to open the file:

sudo gedit /etc/timidity/timidity.cfg

Note: You can use other text editors like gvim instead of gedit, depending on your distro.

We have to add this line at the end of the file:

source /etc/timidity/fluidr3_gm.cfg

But the file probably contains that line already, in a commented state. All you have to do is uncomment it (by removing the hash (#) in front of it). Now you may comment the line of the current soundfont by adding a # before it.

The configurat­ion is complete and TiMidity++ starts to use the new soundfont.

Note: You can use multiple soundfonts at a time by keeping their configurat­ion lines uncommente­d. When both soundfonts contain the same instrument, the last soundfont is used. For advanced mixing of soundfonts, you have to edit their configurat­ion files (e.g., /etc/timidity/fluidr3_gm.cfg) or create a new soundfont using programs like Swami.

 ??  ??
 ??  ??
 ??  ??

Newspapers in English

Newspapers from India