Fluidsynth soundfont patch

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

Fluidsynth soundfont patch

Postby ykhwong » 2011-3-19 @ 06:55

Due to some compilation issues in older patch(http://www.vogons.org/viewtopic.php?t=26357), 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.
Code: Select all
mididevice=synth
midiconfig=SGM-V2.01.sf2
Attachments
dosbox-fsynth.diff
(14.83 KiB) Downloaded 753 times
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Fluidsynth soundfont patch

Postby leileilol » 2011-3-19 @ 11:49

Awesome!
Looking forward to a new svn build :)

BTW, is it possible to stack soundfonts and force AWE32 support? (i.e. getting Eradicator to use it)
User avatar
leileilol
l33t++
 
Posts: 9043
Joined: 2006-12-16 @ 18:03

Re: Fluidsynth soundfont patch

Postby ADDiCT » 2011-3-19 @ 13:10

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.
User avatar
ADDiCT
Oldbie
 
Posts: 1170
Joined: 2007-2-02 @ 15:07
Location: Retroland

Re: Fluidsynth soundfont patch

Postby leileilol » 2011-3-19 @ 14:13

well for starters, fluidsynth doesn't lag 4 seconds behind and its reverb is nowhere near as obnoxious, and it is not as duct-taped as any timidity (which is highly overrated IMO)
User avatar
leileilol
l33t++
 
Posts: 9043
Joined: 2006-12-16 @ 18:03

Re: Fluidsynth soundfont patch

Postby ADDiCT » 2011-3-19 @ 14:38

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 (; .
User avatar
ADDiCT
Oldbie
 
Posts: 1170
Joined: 2007-2-02 @ 15:07
Location: Retroland

Re: Fluidsynth soundfont patch

Postby Dominus » 2011-3-19 @ 15:14

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...
User avatar
Dominus
DOSBox Moderator
 
Posts: 7538
Joined: 2002-10-03 @ 09:54
Location: Vienna or Ludwigsburg

Re: Fluidsynth soundfont patch

Postby ykhwong » 2011-3-19 @ 17:44

This is a patch of fluidsynth + timidity server backend(http://sourceforge.net/tracker/index.php?func=detail&aid=2813231&group_id=52551&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
dosbox-fsynth-timidity.diff
(26.22 KiB) Downloaded 610 times
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Fluidsynth soundfont patch

Postby ykhwong » 2011-3-28 @ 08:55

The default gain setting makes the volume too low in DOSBox. To increase gain, add the following code to MidiDriver_FluidSynth::open().
Code: Select all
      fluid_settings_setnum(settings,
         "synth.gain", 1);
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Fluidsynth soundfont patch

Postby truth_deleted » 2014-1-11 @ 19:29

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
dosbox-fsynth-2.diff
fluidsynth patch for dosbox-svn (1/11/14); requires fluidsynth library
(16.04 KiB) Downloaded 131 times
truth_deleted
 

Re: Fluidsynth soundfont patch

Postby Dominus » 2014-1-11 @ 20:00

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 ;)
User avatar
Dominus
DOSBox Moderator
 
Posts: 7538
Joined: 2002-10-03 @ 09:54
Location: Vienna or Ludwigsburg

Re: Fluidsynth soundfont patch

Postby collector » 2014-1-11 @ 21:38

Which is exactly what the actual E-MU allows you to do.
User avatar
collector
l33t
 
Posts: 4097
Joined: 2003-1-15 @ 10:39

Re: Fluidsynth soundfont patch

Postby Dominus » 2014-1-11 @ 21:43

E-MU?
User avatar
Dominus
DOSBox Moderator
 
Posts: 7538
Joined: 2002-10-03 @ 09:54
Location: Vienna or Ludwigsburg

Re: Fluidsynth soundfont patch

Postby bloodbat » 2014-1-12 @ 06:22

Maker of the chips, now property of Creative Labs.
User avatar
bloodbat
Oldbie
 
Posts: 791
Joined: 2009-12-06 @ 07:11

Re: Fluidsynth soundfont patch

Postby truth_deleted » 2014-1-19 @ 05:32

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
dosbox-SVN+GM.zip
Test binary of dosbox-SVN+Synth (win32)
(1.65 MiB) Downloaded 152 times
truth_deleted
 

Re: Fluidsynth soundfont patch

Postby truth_deleted » 2014-1-19 @ 21:49

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
dosbox-SVN+GM+REVERB.zip
Test binary of dosbox-SVN+Synth+REVERB (win32)
(1.65 MiB) Downloaded 142 times
dosbox-fsynth-2-REVERB.diff
fluidsynth+REVERB patch for dosbox-svn (1/11/14)
(16.04 KiB) Downloaded 114 times
fluidsynth_REVERB.diff
fluidsynth v1.1.6 REVERB patch
(1.72 KiB) Downloaded 110 times
truth_deleted
 

Re: Fluidsynth soundfont patch

Postby bloodbat » 2014-10-13 @ 20:58

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
fluidsynth.mp3
Fluidsynth
(742.65 KiB) Downloaded 113 times
x-fi synth.mp3
X-Fi Synth sample
(355.71 KiB) Downloaded 93 times
User avatar
bloodbat
Oldbie
 
Posts: 791
Joined: 2009-12-06 @ 07:11

Re: Fluidsynth soundfont patch

Postby truth_deleted » 2014-10-14 @ 00:25

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?
truth_deleted
 

Re: Fluidsynth soundfont patch

Postby bloodbat » 2014-10-14 @ 03:36

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.
User avatar
bloodbat
Oldbie
 
Posts: 791
Joined: 2009-12-06 @ 07:11

Re: Fluidsynth soundfont patch

Postby bloodbat » 2014-10-14 @ 03:47

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
sierra_000.zip
A quick test midi
(3.16 KiB) Downloaded 101 times
User avatar
bloodbat
Oldbie
 
Posts: 791
Joined: 2009-12-06 @ 07:11

Re: Fluidsynth soundfont patch

Postby truth_deleted » 2014-10-14 @ 05:06

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: viewtopic.php?f=31&t=38034, 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: viewtopic.php?f=41&t=31630, 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.
truth_deleted
 

Next

Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 1 guest