How to Play Midi Music on Linux

botond published 2018. 12. 17., h - 11:33 time

Content

 

Introductory

These days, I’ve stumbled upon my thousand-year-old midi music, which has been going through the long years from the good old Doom 1 era deep in the subdirectories of my machine. I thought I'd listen to them again ... But unfortunately I wasn't successful because none of the players knew the format. So with a little trace, but in the end I managed to play the midi music.

In this description, we force our Linux system to play our old midi music with our favorite media player programs, such as Audacious or VLC Player, or we can even launch them from the command line.

 

 

Sound sample set (SoundFont) files

Before we can play midi music, we will need a so-called. sound sample set file (Sound Font), which stores sound samples of instruments needed to play midi music. This is because midi music is not an audio format, but rather resembles a kind of script that contains the soundtracks, the beats in them, and which instrument to play in that particular soundtrack, at what pitch, and so on. And the instruments are loaded from this sound sample set file by the music player you are using. As a result, midi files are extremely small in size, with just a few kbytes of file size, long, many-minute music can be compiled. That's why they were so popular.

This was natural on windows systems by default to support the midi file format in all media player programs, but on Linux, unfortunately, these sound sample set files must be obtained separately by downloading a simple file or even installing the package in the distribution.

In the following chapters, we will obtain these files, as well as operate them with two player programs and from the command line.

 

I have a Debian 9 operating system with an LXDE desktop environment, I tested this. For other distributions or desktop environments, it is not guaranteed that things will look exactly the same or work out (package dependencies, etc.).

 

Play Midi Music with Audacious Music Player

Install the packages containing the FluidSynth software MIDI synthesizer sound sample set files, fluid-soundfont-gm and the fluid-soundfont-gs package to APT with the package manager:

apt-get install fluid-soundfont-gm fluid-soundfont-gs

Note that the first package will not upload a normally small file, but an 142 Mb.

After installing the packages, the required sound sample set files are a / Usr / share / sounds / sf2 directory, but in other distributions they may land in another directory. The location of the files is as follows dpkg command if you do not put them in the directory above:

dpkg -L fluid-soundfont-gm

Then launch the Audacious music player, not the QT interface, but the regular GTK window, and then click File menu options:

Audacious - Options - Plugins - Input - AMIDI Plugin

Then, as shown in the picture, go to the Extensions main menu, then to the Input tab at the top, select the AMIDI-Plug (MIDI Player) plugin and click the settings button below.

This will bring up the plugin configuration window:

Audacious - AMIDI Plugin Settings

Here in the middle SoundFont libraries section, add the file you see in the image by right-clicking the plus button in the file browser. Or, if the file was on a different path, we would of course specify it.

Then close the panel and you're done.

From now on, the Audacious music player will now launch our MIDI files.

 

Play midi music with VLC media player

To play MIDI files on the VLC media player, install Fluidsynth VLC plugin package:

apt-get install vlc-plugin-fluidsynth

Then, once the player was open, you just have to restart it and MIDI music is already in it.

This does not require any other setup, but you can do this here, for example, if you want to configure another SoundFont file (eg your own), or more, click Tools - Options in the main VLC window:

VLC Media Player - Input, Codec Settings, Easy Mode

Here, click "All" in the lower left corner, then the window will switch to expanded view. Here, click the Input / Codecs group, including the Audio Codecs subgroup, and then the FluidSynth codec:

VLC Media Player - Preferences - Input / Codecs - Audio Codecs - FluidSynth

And here we can still adjust things if needed.

 

 

Play midi music from the command line

So far, we've used FluidSynth's music and media player plugin and codec, now it's Fluidsynth install a program (package) for MIDI playback from the command line:

apt-get install fluidsynth

Then the Fluidsynth command to play your MIDI files as follows:

fluidsynth -a alsa -m alsa_seq -i /usr/share/sounds/sf2/FluidR3_GM.sf2 <MIDI fájl>

(Here is the CTRL + C keys to pause playback.)

 

Conclusion

Now you can easily play your MIDI music with your favorite media player. In addition, there are many media players, and many of them are likely to configure the ability to open MIDI files by specifying a SoundFont file. I use these two so I set them up on my machine as well. But you can experiment with other media player programs in the light of the above.