[LINUX] Check points when MIDI does not work in a program using SDL_mixer

In the game Simutrans, the BGM is a MIDI file, and I was in trouble because the BGM did not work, so if I was looking for a solution, I used SDL_mixer on Linux. I can solve it with a common (presumably) solution when I am there, and I can not find Japanese information so I will share it.

Operating environment

As mentioned above, I have only tried one game this time. On top of that, the environment that worked well this time is as follows.

Also, it is a story under the PulseAudio environment.

Confirmation points

TiMidity ++ or FluidSynth

First of all, you need to include at least one of these in order to play MIDI on Linux. In this case, I checked one by one with both of them included, but since each worked normally, it seems that either one is fine. Also, you can't just install it, you need to daemonize it with timidity -iA orfluidsynth -a pulseaudio -malsa_seq -o midi.autoconnect 1 [SOUND_FONT]. Adjust individual options to suit your environment.

Soundfont

I think it depends on the OS, but at least in Arch Linux, even if TiMidity ++ or FluidSynth is installed, SoundFont will not be included, so it is necessary to install it separately. When converting the installed SoundFont to a daemon, specify it in the argument such as /etc/timidity++/timidity.conf in the case of TiMidity ++ and in the case of FluidSynth.

SDL_SOUNDFONTS When executing a program using SDL_mixer, specify the path of the SoundFont set above as SDL_SOUNDFONTS = / path / to / soundfont.sf2 ./program. I haven't tried it, but I think it's okay to set it with .bashrc etc.

mute

It should be played by the work so far, but if it does not play, please check if it is muted just in case. In this case, it has been played well so far.

Finally

The information of SDL_SOUNDFONTS was not found and was fitted, and when it was found, it was written as information when combining FluidSynth with SDL_mixer, so it was difficult to find. In addition, I wrote it in the operating environment, but since it is ** a story in SDL instead of SDL2 **, it may have changed in SDL2.

Information source

Recommended Posts

Check points when MIDI does not work in a program using SDL_mixer
Command when ACPI shutdown does not work in VirtualBox
When writing a program in Python
When the program pip installed on Mac / Marvericks does not work
Check items when the imported python module does not work as expected
An error that does not work as expected when calling the tkinter module in a text editor
Create a MIDI file in Python using pretty_midi
When wildcard specification does not work with pylint
Patch when full text search does not work in GAE / Python local environment
There is a pattern that the program did not stop when using Python threading
[Python] Precautions when it does not work even if TimedRotatingFileHandler is set in basicConfig in python2
Check when the version does not switch with pyenv
Summary of points to keep in mind when writing a program that runs on Python 2.5
A story that stumbled when using pip in a proxy environment
A memo when creating a directed graph using Graphviz in Python
Check when the Docker container does not connect to the Internet
Problems when using Elasticsearch as a data source in Redash
(Personal) points when using ctypes
When incrementing the value of a key that does not exist
I got a TypeError:'int' object is not iterable when using keras
[Python] Appears when using iterdir () etc. [Errno 20] Not a directory:'*** / .DS_Store'
Solution when background-cover of Linux version VS Code does not work
I get a can't set attribute when using @property in python