Skip to content
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

dosbox: ensure freepats soundfonts are configured #2780

Open
wants to merge 2 commits into
base: fkms_rpi4
from

Conversation

@cmitu
Copy link
Contributor

commented Jul 14, 2019

In Buster, the default soundfont configured in Timidity is fluidr3_gm. Without it, timidity logs an error during the runcommand startup for dosbox and the emulator is not started:

   /etc/timidity/fluidr3_gm.cfg: No such file or directory
   timidity: Error reading configuration file.
   Please check /etc/timidity/timidity.cfg

We could use the fluid-soundfont-gm as default (and remove freepats), that would require to modifying /etc/timidity/timidity.cfg . On the other hand, the fluid-soundfont-gm is considerably larger than freepats (149MB vs 34MB).

@psyke83

This comment has been minimized.

Copy link
Member

commented Jul 14, 2019

Grepping /usr/bin/timidity, I see %s/.timidity.cfg. This looks like a user override (i.e. /home/pi/.timidity.cfg). Perhaps we could try that?

I don't mind using fluidsynth, but as you said, the package is considerably larger, and may also affect memory usage. I do recall the MIDI playback being quite different as well.

@cmitu

This comment has been minimized.

Copy link
Contributor Author

commented Jul 14, 2019

I agree, I'll see if we can override with a user configuration file and keep using freepats.

@cmitu cmitu force-pushed the cmitu:dosbox-soundfonts-buster branch from 0e00f5a to 32a4d2f Jul 16, 2019

@cmitu cmitu changed the title dosbox: add Fluidsynth soundfonts in dependencies dosbox: ensure freepats soundfonts are configured Jul 16, 2019

@cmitu

This comment has been minimized.

Copy link
Contributor Author

commented Jul 16, 2019

Unfortunately the user config ($HOME/.timidity.cfg) is not an override, but an addition to the main .cfg and it's read after the system config.
I have added a helper function to deal with the system config (/etc/timidify/timidity.cfg) and modified also the +Start DosBox.sh script to not loop indefinitely, just in case there is an error during timidity startup.

@hhromic

This comment has been minimized.

Copy link
Member

commented Jul 16, 2019

Be aware that dosbox is not the only module using freepats, perhaps _config_soundfonts_freepats_dosbox() can be migrated to helpers and be run from any module using it.

@cmitu

This comment has been minimized.

Copy link
Contributor Author

commented Jul 16, 2019

@hhromic Thanks for the pointer - I'll take a look. I see zdoom and eduke have freepats and timidity, I'll give it a test.

@@ -54,6 +54,20 @@ function build_dosbox() {
md_ret_require="$md_build/src/dosbox"
}

# helper method to ensure that 'freepats' soundfonts are configured for Timidity
function _config_soundfonts_freepats_dosbox()

This comment has been minimized.

Copy link
@psyke83

psyke83 Jul 16, 2019

Member

Are you searching for the package name via dpkg? I don't think it's correct, as it's fluid-soundfont-gm and fluidr3_gm.cfg.

Could you also use our helper functions for this as well as editing the file? i.e.:

# helper method to ensure that 'freepats' soundfonts are configured for Timidity
function _config_soundfonts_freepats_dosbox()
{
    hasPackage fluid-soundfont-gm && return 0

    iniConfig " " "" "/etc/timidity/timidity.cfg"
    iniSet "source" "/etc/timidity/freepats.cfg"

    systemctl is-active --quiet timidity && systemctl restart timidity
}

The last line would also restart any running timidity daemon instance, just in case.

This comment has been minimized.

Copy link
@psyke83

psyke83 Jul 16, 2019

Member

Also forgot to mention: the exit 0 will also prematurely end the configure_dosbox function if that package is installed, so it should return instead.

This comment has been minimized.

Copy link
@cmitu

cmitu Jul 16, 2019

Author Contributor

I forgot about the hasPackage - thanks for the pointers. But I think multiple source can appear in a single .cfg file, so I'm not sure that using initSet .

@cmitu

This comment has been minimized.

Copy link
Contributor Author

commented Jul 21, 2019

So, there are 2 additional scriptmodules including freepats and/or timidity

  • (ports) zdoom . By default, it uses the system's MIDI device, whatever it is. It has options to switch to different MIDI devices, including timidity. When selected, it uses timidity directly to play the MIDI files. If the config file is incorrect (the issue at hand), then playing the background music sound fails.
    zdoom does however has an OPL software synth' option built in, which works without any soundfonts installed.

  • (ports) eduke32. It supports MIDI playback through a built-in SDL_Mixer based synth or through the EDUKE_MUSIC_CMD environment variable. During testing, I used pmidi (with timidity started in the background) to play music, of course this doesn't work when timidity configuration fails.

Both zdoom and eduke32 are not using by default timidity, they must be configured specifically. For eduke32 there is no configuration option to choose the MIDI playback command, zdoom has the options in the Sound Configuration screen.

@joolswills joolswills changed the base branch from master to fkms_rpi4 Aug 12, 2019

@joolswills

This comment has been minimized.

Copy link
Member

commented Aug 12, 2019

I have edited the base for this to point to the new branch for fkms/rpi4/buster. Hope that's ok - let me know and I'll merge. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.