VOGONS


Fluidsynth soundfont patch

Topic actions

First post, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

Due to some compilation issues in older patch(help using Fluidsynth patch with Dosbox 0.74 by clestrade), I renewed it against the current SVN of DOSBox.

You may use the latest version of Fluidsynth library. It works fine with some delays at startup even in Windows. Tested with SGM-V2.01.sf2 (about 250MB), one of the free soundfonts circulating on the web.

Set mididevice=synth and midiconfig= to your soundfont file.

mididevice=synth
midiconfig=SGM-V2.01.sf2

Attachments

  • Filename
    dosbox-fsynth.diff
    File size
    14.83 KiB
    Downloads
    801 downloads
    File license
    Fair use/fair dealing exception

Reply 2 of 75, by ADDiCT

User metadata
Rank Oldbie
Rank
Oldbie

This is interesting! I have zero experience with FluidSynth, does it have any advantages/disadvantages compared to Timidity+? I'm currently starting Timidity+ each time before starting DOSBox (wouldn't want it running all the time and eating memory, as I need it only for gaming), so an integrated solution would be neat.

Reply 4 of 75, by ADDiCT

User metadata
Rank Oldbie
Rank
Oldbie

I've never had any lags with Timidity, can't say anything about its reverb (IIRC it's disabled by default, not sure), dunno how to duct-tape software and don't care about how a piece of software is "rated". I'd love to hear tangible opinions however (; .

Reply 5 of 75, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

There is also a nice patch in the tracker for OS X' coreaudio to load a different soundfont. Same patch also for Exult and I noticed that the same soundfont has more oomph with fluidsynth...

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for OS X (10.4-10.14 ppc/intel 32/64bit) codesigned for gatekeeper
DOSBox SVN with SDL2 snapshot for OS X (10.7-10.14 intel 64bit) codesigned for gatekeeper

Reply 6 of 75, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

This is a patch of fluidsynth + timidity server backend(http://sourceforge.net/tracker/index.php?func … 551&atid=467234) for DOSBox.

You don't need timidity library at all but it only requires SDL_net. (It will not allow to use timidity directly.)

Attachments

Reply 7 of 75, by ykhwong

User metadata
Rank Oldbie
Rank
Oldbie

The default gain setting makes the volume too low in DOSBox. To increase gain, add the following code to MidiDriver_FluidSynth::open().

		fluid_settings_setnum(settings,
"synth.gain", 1);

Reply 8 of 75, by truth_deleted

User metadata

Updated the above patch for dosbox-svn code as of 1/11/14. Also, added several fluidsynth settings to patch so the midi output closely mimics the reference General MIDI devices (MS GS Wavetable and Roland SC-55). Strongly recommend this soundfont to accompany the patch: Scc1t2.sf2. Tested against several DOS games. Binary is available via the web link in signature.

Attachments

  • Filename
    dosbox-fsynth-2.diff
    File size
    16.04 KiB
    Downloads
    167 downloads
    File comment
    fluidsynth patch for dosbox-svn (1/11/14); requires fluidsynth library
    File license
    Fair use/fair dealing exception

Reply 9 of 75, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

I'm not really using it but a nice addition would be the possibility to stack several soundfonts. Exult has that option and through that you can achieve an instrument perfection that one soundfont can't give you 😉

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for OS X (10.4-10.14 ppc/intel 32/64bit) codesigned for gatekeeper
DOSBox SVN with SDL2 snapshot for OS X (10.7-10.14 intel 64bit) codesigned for gatekeeper

Reply 11 of 75, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

E-MU?

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for OS X (10.4-10.14 ppc/intel 32/64bit) codesigned for gatekeeper
DOSBox SVN with SDL2 snapshot for OS X (10.7-10.14 intel 64bit) codesigned for gatekeeper

Reply 13 of 75, by truth_deleted

User metadata

Attached a test binary of dosbox-SVN+fluidsynth. Fluidsynth 1.1.6 was built by mingw32 (1/19/14), according to these instructions. It is dependent on glib and gthread libraries, also included in the attached archive. Since this was built by cmake, I had the opportunity to customize the build and exclude unnecessary dependencies. Recommend the Scc1t2.sf2 as an accurate soundfont. Other than choosing "General MIDI" in the game's options, two edits are required to your dosbox.conf file:
mididevice=synth
midiconfig=Scc1t2.sf2

Dosbox+fluidsynth was compiled for low latency MIDI audio and, in theory, should be ~1/10th latency of the built-in MS driver. This was tested with the above soundfont only.

Attachments

  • Filename
    dosbox-SVN+GM.zip
    File size
    1.65 MiB
    Downloads
    200 downloads
    File comment
    Test binary of dosbox-SVN+Synth (win32)
    File license
    Fair use/fair dealing exception

Reply 14 of 75, by truth_deleted

User metadata

Attached a second test binary of dosbox-SVN+fluidsynth+REVERB effects. Used same build environment as above. Included reverb and chorus by two "switches" in the dosbox fluidsynth patch and modified a fluidsynth header file for satisfactory levels of chorus and reverb. Attached both patches below.

The default reverb and chorus settings are not ideal for gaming and there is discussion to correct these values: http://forums.scummvm.org/viewtopic.php?t=11632. Used these suggested values which are included in the attached fluidsynth patch.

Use the binary in the post above if these effects are not desired.

Edit: recommend WeedsGM3.sf2 for a soundfont, instead of the above Scc1t2.sf2. In SimCity2000, the latter soundfont has missing samples so certain sounds are missing from playback, while WeedsGM3 has these sounds. I don't believe this affects general music as much as the extra sound effects during gameplay.

Attachments

  • Filename
    dosbox-SVN+GM+REVERB.zip
    File size
    1.65 MiB
    Downloads
    193 downloads
    File comment
    Test binary of dosbox-SVN+Synth+REVERB (win32)
    File license
    Fair use/fair dealing exception
  • Filename
    dosbox-fsynth-2-REVERB.diff
    File size
    16.04 KiB
    Downloads
    149 downloads
    File comment
    fluidsynth+REVERB patch for dosbox-svn (1/11/14)
    File license
    Fair use/fair dealing exception
  • Filename
    fluidsynth_REVERB.diff
    File size
    1.72 KiB
    Downloads
    141 downloads
    File comment
    fluidsynth v1.1.6 REVERB patch
    File license
    Fair use/fair dealing exception

Reply 15 of 75, by bloodbat

User metadata
Rank Oldbie
Rank
Oldbie

Hi! Thanks for all the hard work on the fluidsynth patch, however, it drops instruments. Attached here are two sample files: both are recorded using your DosBox build attached in another post here; the first is the game's music playing through my X-Fi (the "win32" midi driver), the second is going through the build's built in Fluidsynth (the "synth" driver), as you can hear the Fluidsynth one is missing percussion. Both are using the same soundfont (SC-55.sf2). I built my own DosBox with VIsual C++ using your patch (and my own fluidsynth.dll) and the behavior is the same (even when altering parameters to suit Windows' default settings for fluidsynth).
I hope this can be fixed 😀

Attachments

  • Filename
    fluidsynth.mp3
    File size
    742.65 KiB
    Downloads
    144 downloads
    File comment
    Fluidsynth
    File license
    Fair use/fair dealing exception
  • Filename
    x-fi synth.mp3
    File size
    355.71 KiB
    Downloads
    123 downloads
    File comment
    X-Fi Synth sample
    File license
    Fair use/fair dealing exception

Reply 16 of 75, by truth_deleted

User metadata

That's a good test where you isolated the issue. I'll playback the samples tonight.

Edit: definitely missing instruments in the fluidsynth sample. 😀 Just to be sure, it would be worthwhile to test with the WeedsGM3 soundfont and possibly one other robust soundfont. I know your test showed that this shouldn't be the case since you controlled for a soundfont effect, but in the slight chance that the cause is an interaction between the soundfont and the software synthesizer. These soundfonts have produced different sounds in different synthesizers, although I can't recall that it would result in missed instruments.

Given another soundfont doesn't help, then would it be possible to upload a midi file which reproduces missed instruments?

Reply 17 of 75, by bloodbat

User metadata
Rank Oldbie
Rank
Oldbie

I'll capture the MIDI output and upload it, I'll also test with another soundfont, however, out of curiosity, I played the same sequence through the bass midi Windows driver and it works as it should using the same soundfont, which I'd say is pretty robust.

Edit: same behaviour with WeedsGM3...missing instruments...also with scc1t2.sf2.

Reply 18 of 75, by bloodbat

User metadata
Rank Oldbie
Rank
Oldbie

Heres a midi capture of the particular section, recorded while using fluidsynth with the missing instruments. If I play this MIDI using another player (say...foobar through bassmidi or the x-fi) it sounds as it should.

Attachments

  • Filename
    sierra_000.zip
    File size
    3.16 KiB
    Downloads
    131 downloads
    File comment
    A quick test midi
    File license
    Fair use/fair dealing exception

Reply 19 of 75, by truth_deleted

User metadata

Thank you for testing! I'll see if I can find a simple solution to the missed notes.

Edit: it is very likely a bug in the fluidsynth patch for dosbox instead of fluidsynth itself. Confirmed by running the native fluidsynth binary here: Converting MIDI output to an audio file, which produces the proper instrument samples while using robust soundfonts. My best guess is that there is a problem in processing a midi event because the patch is incomplete. I wish I could isolate the midi events which correspond to the missing percussion sounds.

Also, I now recall this "missing instrument" issue while working on the patch, but I didn't debug beyond examining the original code for obvious errors in the workflow. There is an alternative patch here: FluidSynth MIDI driver, but it didn't compile cleanly, at least initially, so I used the above patch. In addition, both patches appear very similar, although with this missing instrument issue, it pays to try the alternative patch and confirm whether it somehow avoids this issue. Each handles the midi processing with a different API set (of functions), too.

Edit2: isolated the issue. It's the selected drum set. Confirmed by using "megamid" software in dosbox; the drums are missing unless the drum kit is changed by pressing the "." key. My best guess is that the drum kit isn't finding a proper default value upon playback of the midi file.