Closed Renegade661 closed 1 year ago
I believe this bug should be addressed by the package maintainer. It looks like fheroes2 package was linked with SDL_mixer that was built with Timidity MIDI backend but Timidity either not configured or not installed properly.
@Renegade661 looks like you are trying to use MIDI music. Also your problem could be because Timidity (or Fluidsynth) can't find MIDI font. Could you try to put this file to ~/.fheroes2/files/soundfonts
directory?
@undef21 I have no idea why SDL_mixer that is used by this package is built with Timidity in the first place. On macOS there is decent native MIDI backend supported by SDL_mixer, there is no need in Timidity or Fluidsynth as well as our soundfonts. MIDI support is provided by the OS. Also AFAIK Timidity does not support SF3 format, but I'm not sure about that.
@oleg-derevenetz Looks like sdl2-mixer is built with fluid-synth backend and with disabled native midi in Homebrew. Probably fluid-synth needs MIDI fonts.
There were users with same problem in Discord channel and LOR. They used Archlinux with sdl2_mixer's internal Timidity backend. The worked solutions were setting SDL_SOUNDFONTS=/usr/share/soundfonts/FluidR3_GM.sf2
(fluid-soundfont package should be installed) or using fheroes2.sf3
soundfont.
Reading this issue, i'll think i'll remember something similar for Linux. So I'll checked. Also for Linux, the flatpak version, doesn't produce any MIDI music.
@Renegade661 looks like you are trying to use MIDI music. Also your problem could be because Timidity (or Fluidsynth) can't find MIDI font. Could you try to put this file to
~/.fheroes2/files/soundfonts
directory?
@undef21 , thanks ! It solved the problem. Juste had to create the soundfonts directory and add the file you provided. Music is now played from the startup menu. No error is being reported in the terminal anymore.
@Mr-Bajs I guess that copying fheroes2.sf3 to appropriate place will help with flatpak version too. It's a common issue for many Linux distributions and for macOS as we can see. The main problem is sdl2_mixer is built with different midi backends and there aren't dependencies with these backends and soundfonts. So users have to manually install soundfonts and tune midi configs. In fact this issue should be resolved by maintainers of corresponding package systems.
@oleg-derevenetz How about to distribute Linux and macOS binary archives with fheroes2.sf3 too? 3Mb isn't so high price for partial resolving this issue)
How about to distribute Linux and macOS binary archives with fheroes2.sf3 too? 3Mb isn't so high price for partial resolving this issue)
You are free to offer a PR :) But I doubt that the number of users that run fheroes2 from our binary archives on Linux or macOS is comparable with those who use the packages from a package manager (one or the other).
@Mr-Bajs I guess that copying fheroes2.sf3 to appropriate place will help with flatpak version too. It's a common issue for many Linux distributions and for macOS as we can see. The main problem is sdl2_mixer is built with different midi backends and there aren't dependencies with these backends and soundfonts. So users have to manually install soundfonts and tune midi configs. In fact this issue should be resolved by maintainers of corresponding package systems.
Hi I tried that. Doesn't work :( I tried installing from the Linux x86-64-zip file. That works fine though (Debian based). I'm probably wrong on this but isn't flatpak depenencies something that doesn't involve the OS dependencies but installs the dependencies from the Flathub repo. In other words even if the OS have the right dependencies installed it fails because it misses the dependencies in the flatpak runtime. Could it be that there is is a MIDI dependency that the flatpak misses to install from the flathub repo of depenencies? I'm only guessing.
@Mr-Bajs
I've tried Flatpak version. It has 2 issues. The first one is the missed soundfonts and the second one is flatpack isolation.
@oleg-derevenetz
But I doubt that the number of users that run fheroes2 from our binary archives on Linux or macOS is comparable with those who use the packages from a package manager (one or the other).
In that case issues with midi should be redirected to package maintainers in corresponding distributions.
I'm inclining to add a mandatory check of files needed for midi playback like we did for *.h2d files. In this case we will force distributors have all needed files. Of course it's not the best solution but might solve some issues.
What do you think?
@ihhub
I'm inclining to add a mandatory check of files needed for midi playback
How do you know what files are needed? It depends on MIDI backend used. For example, on macOS when fheroes2 is installed using MacPorts there is no files needed at all, because it uses native macOS MIDI. I think this should be a headache of package maintainers for a specific OS/distribution/package manager/whatever.
@ihhub
Different distributives have sdl_mixer library with different MIDI backends, hardcoded paths for configs and soundfonts, etc. This bug isn't common for macOS, it's a distro-specific bug that should be fixed by a Homebrew package maintainer. Fheroes2 project already has soundfont file which can help maintainers.
Hi @oleg-derevenetz and @undef21 , thanks for your opinions! I am reclassifying this issue as low priority as this is beyond our scope of work.
@Renegade661, @oleg-derevenetz
Homebrew's package timidity
contains freepats
soundfonts. It could help to get MIDI sound in Homebrew version of fheroes2. Could you run brew install timidity
to check this? If this helps we can close this bug.
@undef21 I don't use Homebrew (I prefer MacPorts, so I maintain the MacPorts fheroes2 package and in general it is not recommended to mix MacPorts packages with Homebrew packages). However if this helps, it would be good to add timidity to dependencies of fheroes2 Homebrew package. But it's the task of the package maintainer of course.
@Renegade661, @oleg-derevenetz
Homebrew's package
timidity
containsfreepats
soundfonts. It could help to get MIDI sound in Homebrew version of fheroes2. Could you runbrew install timidity
to check this? If this helps we can close this bug.
brew install timidity
is what I tried before I reported the error here. Reinstalling Timidity this way did not change the problem.
@Mr-Bajs
MIDI works in the Flatpak version.
Try to copy android/app/src/main/assets/{instruments,timidity.cfg}
from source code to ~/.var/app/io.github.ihhub.Fheroes2/
then run flatpak run --env=TIMIDITY_CFG=/home/$USER/.var/app/io.github.ihhub.Fheroes2/timidity.cfg io.github.ihhub.Fheroes2
@undef21 thanks, it works. So then I assume that these files are missing from the flatpak?
@Mr-Bajs Yes, the flatpak package missed midi samples and correct timidity.cfg. This issue is fixed in the latest version of the flatpak package.
Hi @Mr-Bajs , @undef21 and @oleg-derevenetz , are we good to close this issue as completed?
Hi @ihhub this issue has nothing to do with our code, this is a package dependency issue on a specific OS, and it should have been addressed by maintainer of that package. It can be closed IMHO.
Preliminary checks
Platform
macOS
Describe the bug
v 1.02 on macOS Monterey 12.6.1, installed via Brew. No music in being played in game. Sound effects are played. macOS terminal outputs this error as soon as a music is supposed to be played:
[ERROR] createMusic: Failed to create a music track from memory. The error: Couldn't open timidity.cfg
Save file
n/a
Additional info
No response