Skip to content

[Feature Request] Add MIDI Sound Support (TiMidity++) to Flatpak for Older Games (e.g., TES: Arena) #4556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4Vertikal4 opened this issue May 23, 2025 · 3 comments
Labels
feature-request New feature needs to be implemented.

Comments

@4Vertikal4
Copy link

Problem description

Older games, such as The Elder Scrolls: Arena, rely on MIDI for their soundtrack. When playing these games through the Heroic Games Launcher Flatpak on Linux, there is currently no sound because the Flatpak environment lacks a MIDI synthesizer.

Feature description

I propose integrating TiMidity++ (a popular MIDI synthesizer) and a general MIDI soundfont (like FluidR3_GM) directly into the Heroic Games Launcher Flatpak. This would provide out-of-the-box MIDI audio for games that require it.

My initial approach was a local fix outside of Flatpak, which worked successfully.

  1. Installed timidity++ and fluid-soundfont-gm via my system's package manager.
  2. Configured /etc/timidity/timidity.cfg to use the FluidR3 soundfont.
  3. Used a launch script to start timidity -iA & before launching the game via Heroic, which then had full MIDI sound.

I've been working on adding this functionality to the com.heroicgameslauncher.hgl.yml Flatpak manifest and have made significant progress. I'm hoping to complete this and contribute it, but I've hit a snag at the final step and would appreciate some guidance or a check if my overall direction is sound.

# --- MIDI Support (TiMidity++ with FluidR3_GM) ---
- name: timidity
  buildsystem: autotools
  config-opts:
    - --enable-alsa
  cleanup: ["*.la", "*.a", "/include", "/lib/pkgconfig", "/share/man", "/share/doc"]
  sources:
    - type: archive
      url: https://sourceforge.net/projects/timidity/files/TiMidity++/TiMidity++-2.15.0/TiMidity++-2.15.0.tar.bz2
      sha256: 161fc0395af16b51f7117ad007c3e434c825a308fa29ad44b626ee8f9bb1c8f5
    - type: inline
      dest-filename: custom-timidity.cfg
      contents: |
        dir /app/share/soundfonts

        source /app/share/soundfonts/fluid3gm.cfg

        opt EFresamp=d
        opt EFvlpf=d
        opt EFreverb=d
  post-install:
    - install -Dm644 custom-timidity.cfg ${FLATPAK_DEST}/etc/timidity.cfg

- name: fluidr3-soundfont # Or your chosen name
  buildsystem: simple
  build-commands:
    - echo "Listing files in current directory (should include the tarball):"
    - ls -la ./

    - echo "Listing contents of fluid-soundfont.tar.gz:"
    - tar -tf fluid-soundfont.tar.gz

    - echo "Attempting to extract 'FluidR3 GM2-2.SF2'..."
    - tar -xzf fluid-soundfont.tar.gz -C . "FluidR3 GM2-2.SF2"

    - echo "Listing files after tar extraction attempt:"
    - ls -la ./

    - install -d ${FLATPAK_DEST}/share/soundfonts
    - install -Dm644 "FluidR3 GM2-2.SF2" ${FLATPAK_DEST}/share/soundfonts/FluidR3_GM.sf2 # Installs AS FluidR3_GM.sf2

    - echo "soundfont FluidR3_GM.sf2" > fluid3gm.cfg
    - install -Dm644 fluid3gm.cfg ${FLATPAK_DEST}/share/soundfonts/fluid3gm.cfg
  sources:
    - type: file
      url: https://ftp.osuosl.org/pub/musescore/soundfont/fluid-soundfont.tar.gz
      sha256: c815769e44d86f1507b946a6c48c997c7f650699aea1ec4b11ba66e3415c26b9

The Flatpak build now completes successfully with these modules.
The Current Roadblock: When I try to run TiMidity++ inside the Flatpak sandbox to test:

flatpak run --command=bash com.heroicgameslauncher.hgl
[📦 com.heroicgameslauncher.hgl ~]$ /app/bin/timidity -iA -c /app/etc/timidity.cfg &

I get the following output:

/app/share/timidity/timidity.cfg: No such file or directory
Interface `A' is not compiled in.
Couldn't open output device

Alternatives

No response

Additional information

My Request: I'm keen to get this working and contribute it, as I believe it would be a valuable addition for users wanting to play these classic games.

  • Could anyone offer insights into why TiMidity++ might still report "Interface A is not compiled in" despite the --enable-alsaseq flag? Are there any other dependencies (e.g., ALSA development libraries from the SDK) or configure options I might be missing for the Flatpak SDK environment?

  • Any ideas on the persistent /app/share/timidity/timidity.cfg error, even when using -c?

  • Is this overall approach of bundling TiMidity++ and a soundfont the right direction for solving MIDI in the Heroic Flatpak?

Any help or pointers would be greatly appreciated! I'm happy to provide more details or try further suggestions.

@4Vertikal4 4Vertikal4 added the feature-request New feature needs to be implemented. label May 23, 2025
@flavioislima
Copy link
Member

@4Vertikal4 this would be cool and it seems you already have a good idea on how to make it work. Do you want to open a PR on our Flatpak repo? So we can have this without the need of a new Heroic release:
https://github.com/flathub/com.heroicgameslauncher.hgl

@4Vertikal4
Copy link
Author

Hi @flavioislima,

Thanks so much for the positive feedback !

Yes, I'd be happy to open a PR on the flathub/com.heroicgameslauncher.hgl repository. I'll get my local setup for that specific repo sorted and aim to submit the PR soon.

I'll do a description and the current status, including the "Interface A is not compiled in" issue I'm still trying to resolve with TiMidity++ within the Flatpak environment.

Thanks again!

@4Vertikal4
Copy link
Author

PR opened: flathub/com.heroicgameslauncher.hgl#222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature needs to be implemented.
Projects
None yet
Development

No branches or pull requests

2 participants