How to play midis in new engines for games

For example we can play Space Cadet in Haiku, compiling this engine

But the music is missing, the effects are wav pcm.

We need to install two programs

-Timidity and timidity_freepats

Then create a folder in /etc called timidity [/etc/timidity/] copy all the data from

/boot/system/data/midi/freepats/
to
/etc/timidity/

This method works too in the engine for the game Bermuda Syndrome

Midi playing using timidity and the freepats
https://i.imgur.com/ABWA9GC.mp4

2 Likes

Did you try export SDL_SOUNDFONT=/path/to/your/soundfont before launching the game like explained here?

1 Like

Yes, i did it, the problem is the sdl2 mixer looks for this path (source code sdl2_mixer, file music_timidity.c line 52)

SDL Error: Couldn’t open /etc/timidity/freepats.cfg

Dirty solution is copying the files there and looks solves the problem, other solution is modify the source code of src/codecs/music_timidity.c

define TIMIDITY_CFG_ETC “/boot/system/data/midi/freepats/timidity.cfg”

define TIMIDITY_CFG_FREEPATS “/boot/system/data/midi/freepats/freepats.cfg”

#endif

I compiled and created an hpkg and the solution works

2 Likes