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.
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.
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 or
fluidsynth -a pulseaudio -malsa_seq -o midi.autoconnect 1 [SOUND_FONT]. Adjust individual options to suit your environment.
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.
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
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.
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.