Fluidsynth soundfont patch

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

Re: Fluidsynth soundfont patch

Postby truth_deleted » 2014-10-15 @ 01:52

Attached test binary of dosbox-SVN (r3871) which includes the updated fluidsynth patch and also attached the patch file itself. Includes fix for issue of "missing drum kit", however, nearly all credit to Matt Giuca for his patch.

For this new patch, modify dosbox.conf settings as follows:
mididevice=fluidsynth
midiconfig=dsound:WeedsGM3.sf2

Where midiconfig has values of "audio driver" and a compatible "soundfont" separated by the ":" delimiter character. Note that for Windows, the audio driver is always dsound. As previously, the fluidsynth function is dependent on the fluidsynth library and its dependencies (win32 versions included in attached archive).

For other operating systems, the following audio drivers are recognized by fluidsynth (may require additional dependencies): pulseaudio, alsa, oss, coreaudio, portaudio, sndman, jack.
Attachments
dosbox-3-GM-reverb.zip
dosbox-r3871+fluidsynth-reverb (win32)
(1.79 MiB) Downloaded 133 times
dosbox-fsynth-3-reverb.diff
fluidsynth-reverb patch for dosbox-r3871
(7.24 KiB) Downloaded 128 times
truth_deleted
 

Re: Fluidsynth soundfont patch

Postby bloodbat » 2014-10-15 @ 07:00

I tried the other patch, it did compile cleanly but I never managed to get any sound out of it, I also did remove at some point the driver stuff, since it's useless for my Win. Based build.
It does work as it should, thanks :)

Edit: I removed the driver parts since in Windows they're useless and lead to bigger config strings and it works just fine.
User avatar
bloodbat
Oldbie
 
Posts: 783
Joined: 2009-12-06 @ 07:11

Re: Fluidsynth soundfont patch

Postby truth_deleted » 2014-10-15 @ 16:26

:)

Edit: attached fluidsynth DLL which was built from recent fluidsynth source code (revised on 9/24/14). This is newer than the fluidsynth DLL, version 1.1.16 (8/16/12), archived with the binary posted earlier in this thread (dosbox-3-GM-reverb.zip).

Attached is a single DLL file, so replace fluidsynth-1.dll in the above archive with this attached DLL file, and then run that archived dosbox as usual. Note this is a win32 build via mingw32/gcc which required a patch to source code. This patch is also in the attached archive; it was created by reverting a code change between version 1.1.16 and this latest codebase. A 2nd patch is likewise included for satisfactory levels of chorus and reverb (same as posted earlier in this thread); this patch was applied to this updated DLL.
Attachments
fluidsynth_update.zip
fluidsynth update (version 9/24/14)
(138.13 KiB) Downloaded 143 times
truth_deleted
 

Re: Fluidsynth soundfont patch

Postby bloodbat » 2014-10-18 @ 19:39

Attached a new patch based on the work of truth5678 and Matt Giuca; it removes the need for patching Fluidsynth's synth.h (though you may or may not want to patch ipv6 with truth5678's patch if using code from Fluidsynth's git) and gives the user control over most of Fluidsynth's parameters using DosBox.conf (with its own parameters, not midiconf).
The exposed options (from a sample DosBox.conf help) are:
Code: Select all
fluid.driver: Driver to use with Fluidsynth, not needed under Windows. Available drivers depend on what Fluidsynth was compiled with
Possible values: pulseaudio, alsa, oss, coreaudio, dsound, portaudio, sndman, jack, file, default.
fluid.soundfont: Soundfont to use with Fluidsynth. One must be specified.
fluid.samplerate: Sample rate to use with Fluidsynth.
fluid.gain: Fluidsynth gain.
fluid.polyphony: Fluidsynth polyphony.
fluid.cores: Fluidsynth CPU cores to use, default.
fluid.periods: Fluidsynth periods.
fluid.periodsize: Fluidsynth period size.
fluid.reverb: Fluidsynth use reverb.
Possible values: no, yes.
fluid.chorus: Fluidsynth use chorus.
Possible values: no, yes.
fluid.reverb,roomsize: Fluidsynth reverb room size.
fluid.reverb.damping: Fluidsynth reverb damping.
fluid.reverb.width: Fluidsynth reverb width.
fluid.reverb.level: Fluidsynth reverb level.
fluid.chorus.number: Fluidsynth chorus voices
fluid.chorus.level: Fluidsynth chorus level.
fluid.chorus.speed: Fluidsynth chorus speed.
fluid.chorus.depth: Fluidsynth chorus depth.
fluid.chorus.type: Fluidsynth chorus type. 0 is sine wave, 1 is triangle wave.
Possible values: 0, 1.

These options default to what are considered "nice" values for gaming.
Attachments
fluidsynth_with_conf.diff
(9.7 KiB) Downloaded 135 times
User avatar
bloodbat
Oldbie
 
Posts: 783
Joined: 2009-12-06 @ 07:11

Re: Fluidsynth soundfont patch

Postby dugan » 2016-1-19 @ 06:11

A small modification to bloodbat's patch is attached. It includes the necessary changes to configure.ac. On POSIX systems, it also does shell-expansion of soundfont paths. That means that they'll work if they contain dollar signs (environment variables) and tildes (to signify user directories).

It was generated against r3955.
Attachments
fluidsynth_wordexp.diff
(11.3 KiB) Downloaded 48 times
dugan
Newbie
 
Posts: 46
Joined: 2015-4-04 @ 03:17

Re: Fluidsynth soundfont patch

Postby Yesterplay80 » 2016-10-19 @ 08:16

I would like to add support for fluidsynth to my DOSBox build, but for some reason, I can't get it right. I'm using MinGW+MSYS in Windows, but get some warnings during ./configure:
Code: Select all
configure: WARNING:  *** Could not find fcntl.h and/or ioctl.h which are required for sound and midi support
configure: WARNING:  *** Could not find MidiShare.h, disabling MidiShare driver


Compiling the code doesn't work neither:
Code: Select all
c:/development/dosbox/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lpthread
collect2.exe: error: ld returned 1 exit status
make[2]: *** [fluidsynth.exe] Error 1
make[2]: Leaving directory `/home/MYUSERNAME/fluidsynth-1.1.6/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/MYUSERNAME/fluidsynth-1.1.6/src'
make: *** [all-recursive] Error 1


Does anyone have an idea how I can get fluidsynth compiled under in my environment? GTK+ libraries are installed, MinGW + SYS are up to date. Do I need any other sound driver else than dsound under Windows? And is libsndfile requiered?
My full-featured DOSBox SVN builds (without debugger) for Windows and Linux: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 202
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: Fluidsynth soundfont patch

Postby Dominus » 2016-10-19 @ 11:15

Maybe try with older Fluidsynth versions and go from there
User avatar
Dominus
DOSBox Moderator
 
Posts: 7202
Joined: 2002-10-03 @ 09:54
Location: Vienna

Re: Fluidsynth soundfont patch

Postby James-F » 2016-10-19 @ 16:40

Nowadays there are a LOT of BASS based software to load Soundfonts and play MIDI using them.
Fluidsynth is kinda obsolete in this day and age.
User avatar
James-F
Oldbie
 
Posts: 1358
Joined: 2015-11-30 @ 04:10

Re: Fluidsynth soundfont patch

Postby Kisai » 2016-10-19 @ 20:52

Yesterplay80 wrote:I would like to add support for fluidsynth to my DOSBox build, but for some reason, I can't get it right. I'm using MinGW+MSYS in Windows, but get some warnings during ./configure:
Code: Select all
configure: WARNING:  *** Could not find fcntl.h and/or ioctl.h which are required for sound and midi support
configure: WARNING:  *** Could not find MidiShare.h, disabling MidiShare driver


Compiling the code doesn't work neither:
Code: Select all
c:/development/dosbox/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/ld.exe: cannot find -lpthread
collect2.exe: error: ld returned 1 exit status
make[2]: *** [fluidsynth.exe] Error 1
make[2]: Leaving directory `/home/MYUSERNAME/fluidsynth-1.1.6/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/MYUSERNAME/fluidsynth-1.1.6/src'
make: *** [all-recursive] Error 1


Does anyone have an idea how I can get fluidsynth compiled under in my environment? GTK+ libraries are installed, MinGW + SYS are up to date. Do I need any other sound driver else than dsound under Windows? And is libsndfile requiered?


The version I used in my build, is compiled statically into dosbox, but I used a version that removed all the glib dependencies, which might not be an issue on MINGW.
Code: Select all
#define DSOUND_SUPPORT 0
#define WINMIDI_SUPPORT 0


I'll attach an entire patch against the 1.1.6 svn if it will help, but I think honestly you just need to define those to zero so it doesn't try to build parts it doesn't use.

The attached patch turns the 1.1.6 svn into the version at https://github.com/kirbyfan64/fluidsynth (glib-removal) and finishes the glib removal bits (mostly just removing glib.h) but if you're wondering why all the #include patches were changed, that was because I put the files directly into the dosbox MSVC project, so you might be able to just figure out what you need from that.
Attachments
fluidsynth.1.1.6-noglib.patch
(281.32 KiB) Downloaded 18 times
Kisai
Newbie
 
Posts: 95
Joined: 2010-5-05 @ 08:04

Re: Fluidsynth soundfont patch

Postby gdjacobs » 2016-10-20 @ 04:24

James-F wrote:Nowadays there are a LOT of BASS based software to load Soundfonts and play MIDI using them.
Fluidsynth is kinda obsolete in this day and age.


Except LIBBASS isn't available on non x86 platforms (that I've found).
User avatar
gdjacobs
l33t
 
Posts: 3443
Joined: 2015-11-03 @ 05:51
Location: The Great White North

Re: Fluidsynth soundfont patch

Postby Yesterplay80 » 2016-10-21 @ 12:36

Dominus wrote:Maybe try with older Fluidsynth versions and go from there

I went back until 1.0.9, but none would work.

James-F wrote:Nowadays there are a LOT of BASS based software to load Soundfonts and play MIDI using them.
Fluidsynth is kinda obsolete in this day and age.

Do you know of one that works with DOSBox? Until now I only knew FluidSynth (used in ZDoom).

Kisai wrote:I'll attach an entire patch against the 1.1.6 svn if it will help, but I think honestly you just need to define those to zero so it doesn't try to build parts it doesn't use.

Thank you! I'll try and see what comes out.

UPDATE: I can't even extract Fluidsynth because of symlinks that can't be generated now. :?: And I just played around a bit with BASSMIDI, a much more flexible solution imho that would even work with vanilla DOSBox. So, I second James-F's opinion: Screw Fluidsynth and go with an external MIDI driver with soundfont support!
My full-featured DOSBox SVN builds (without debugger) for Windows and Linux: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 202
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: Fluidsynth soundfont patch

Postby James-F » 2016-10-21 @ 18:39

Yesterplay80 wrote:Do you know of one that works with DOSBox? Until now I only knew FluidSynth (used in ZDoom).

http://www.vogons.org/viewtopic.php?f=24&t=48207
FSMP is the best Windows Midi player currently known to me.
It can load Soundfonts and VSTi plugins, it can be used as a midi router too.
User avatar
James-F
Oldbie
 
Posts: 1358
Joined: 2015-11-30 @ 04:10

Re: Fluidsynth soundfont patch

Postby Kisai » 2016-10-22 @ 18:24

Yesterplay80 wrote:
Dominus wrote:Maybe try with older Fluidsynth versions and go from there

I went back until 1.0.9, but none would work.

James-F wrote:Nowadays there are a LOT of BASS based software to load Soundfonts and play MIDI using them.
Fluidsynth is kinda obsolete in this day and age.

Do you know of one that works with DOSBox? Until now I only knew FluidSynth (used in ZDoom).

Kisai wrote:I'll attach an entire patch against the 1.1.6 svn if it will help, but I think honestly you just need to define those to zero so it doesn't try to build parts it doesn't use.

Thank you! I'll try and see what comes out.

UPDATE: I can't even extract Fluidsynth because of symlinks that can't be generated now. :?: And I just played around a bit with BASSMIDI, a much more flexible solution imho that would even work with vanilla DOSBox. So, I second James-F's opinion: Screw Fluidsynth and go with an external MIDI driver with soundfont support!


The ykhwong build used to just build it directly into dosbox (Eg no external lib) so that might be the issue.
Code: Select all
fluid_adriver.c
fluid_adriver.h
fluid_adsr_env.c
fluid_asr_env.h
fluid_chan.c
fluid_chan.h
fluid_chorus.c
fluid_chorus.h
fluid_cmd.c
fluid_cmd.h
fluid_conv.c
fluid_conv.h
fluid_defsfont.c
fluid_defsfont.h
fluid_event.c
fluid_event_priv.h
fluid_event_queue.h
fluid_gen.c
fluid_gen.h
fluid_hash.c
fluid_hash.h
fluid_iir_filter.c
fluid_iir_filter.h
fluid_lfo.c
fluid_lfo.h
fluid_list.c
fluid_list.h
fluid_mdriver.c
fluid_mdriver.h
fluid_midi.c
fluid_midi.h
fluid_midi_router.c
fluid_midi_router.h
fluid_mod.c
fluid_mod.h
fluid_ramsfont.c
fluid_ramsfont.h
fluid_rev.c
fluid_rev.h
fluid_ringbuffer.c
fluid_rvoice.c
fluid_rvoice_dsp.c
fluid_rvoice_event.c
fluid_rvoice_event.h
fluid_rvoice_mixer.c
fluid_rvoice_mixer.h
fluid_seq.c
fluid_seqbind.c
fluid_settings.c
fluid_settings.h
fluid_sfont.h
fluid_synth.c
fluid_synth.h
fluid_sys.c
fluid_sys.h
fluid_tuning.c
fluid_tuning.h
fluid_voice.c
fluid_voice.h
fluidsynth_priv.h


As I noted previously, I wound up changing the include paths in the source files so it could be compiled into the dosbox without compiling a library. It should be possible to compile a library, but the fluidsynth MSVC projects are empty.

It should be noted that VLC dropped support for fluidsynth on Windows in VLC 2.x because of obsolete glib threading library issues. Hence why you might want to look at the no-glib build.

EDIT: Attached Fluidsynth static x86 and x64 for windows. The DLL's would build but they don't work with dosbox. I'm not sure you can even use this with mingw.

EDITEDIT: You could also try https://github.com/divideconcept/FluidLite , which VLC 3.0 apparently uses.
Attachments
fluidsynth-1.1.6-noglib-dosbox.7z
(601.06 KiB) Downloaded 36 times
Kisai
Newbie
 
Posts: 95
Joined: 2010-5-05 @ 08:04

Re: Fluidsynth soundfont patch

Postby Yesterplay80 » 2017-1-23 @ 10:29

I thought I'd give FluidSynth another try, but still I keep running against walls, though different ones than before. What I did so far:

  • installed CMAKE (GUI version)
  • downloaded Fluidsynth 1.1.6 source code and all dependencies (glib_2.24, glib-dev_2.24, pkg-config_0.23, proxy-libintl), extracted them all into one directory, all according to this description: https://sourceforge.net/p/fluidsynth/wi ... WithCMake/
  • copied dsound.h in the include directory under the directory created in the step above
  • generated the MakeFile with CMAKE, after disabling all other sound drivers, because only Direct Sound seems to be needed under Windows
So far everything worked pretty smooth, a MakeFile for MinGW was created.

But when I try to compile it, I get the following error:

Code: Select all
C:\DOSBox\msys\1.0\home\MYUSERNAME\fluidsynth\build>mingw32-make
[  2%] Building C object src/CMakeFiles/libfluidsynth.dir/fluid_dll.c.obj
In file included from C:/DOSBox/msys/1.0/home/MYUSERNAME/fluidsynth/sources/src/utils/fluidsynth_priv.h:117:0,
                 from C:\DOSBox\msys\1.0\home\MYUSERNAME\fluidsynth\sources\src\fluid_dll.c:22:
c:\dosbox\include\ws2tcpip.h:16:2: error: #error "ws2tcpip.h is not compatible with winsock.h. Include winsock2.h instead."
 #error "ws2tcpip.h is not compatible with winsock.h. Include winsock2.h instead."
  ^
In file included from C:/DOSBox/msys/1.0/home/MYUSERNAME/fluidsynth/sources/src/utils/fluidsynth_priv.h:117:0,
                 from C:\DOSBox\msys\1.0\home\MYUSERNAME\fluidsynth\sources\src\fluid_dll.c:22:
c:\dosbox\include\ws2tcpip.h:124:8: error: redefinition of 'struct ip_mreq'
 struct ip_mreq {
        ^
In file included from c:\dosbox\include\ptw32_errno.h:176:0,
                 from c:\dosbox\include\_ptw32.h:157,
                 from c:\dosbox\include\pthread.h:76,
                 from C:/DOSBox/msys/1.0/home/MYUSERNAME/fluidsynth/sources/src/utils/fluidsynth_priv.h:108,
                 from C:\DOSBox\msys\1.0\home\MYUSERNAME\fluidsynth\sources\src\fluid_dll.c:22:
c:\dosbox\include\winsock.h:278:8: note: originally defined here
 struct ip_mreq {
        ^
src\CMakeFiles\libfluidsynth.dir\build.make:62: recipe for target 'src/CMakeFiles/libfluidsynth.dir/fluid_dll.c.obj' failed
mingw32-make[2]: *** [src/CMakeFiles/libfluidsynth.dir/fluid_dll.c.obj] Error 1
CMakeFiles\Makefile2:86: recipe for target 'src/CMakeFiles/libfluidsynth.dir/all' failed
mingw32-make[1]: *** [src/CMakeFiles/libfluidsynth.dir/all] Error 2
Makefile:148: recipe for target 'all' failed
mingw32-make: *** [all] Error 2



Now I googled the error and everywhere the solution seems to be to include winsock2.h before windows.h. In this case, the file fluidsynth_priv.h seems to be the culprit, so I checked and the includes are already set as they should be:

Code: Select all
#if HAVE_WINDOWS_H
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#endif

Does anyone have an idea how to resolve this issue? And btw., which is the latest diff to add FluidSynth to the DOSBox source code? There seem to be several around the vogons boards...

UPDATE:
Forget all that above; I've managed to compile 2 libraries, a libfluidsynth.a and a libfluidsynth.dll.a using a fresh install of Windows in a VM and an older version of MinGW. Now I tried to compile DOSBox using those libraries, but although I didn't get any errors during compiling, FluidSynth doesn't work, the DOSBox console window still says
Code: Select all
MIDI: Can't find device:fluidsynth, finding default handler.

How do i "enable" or "integrate" those libraries when building DOSBox?
I tried to add them to the configure command (LIBS="... -lfluidsynth -lfluidsynth.dll") and to src\makefile.am (LIBS += -lfluidsynth), neither did work.

ANOTHER UPDATE: I found out that adding
Code: Select all
#define C_FLUIDSYNTH 1
to config.in after compiling and before making my build obviously results in an exe file at least trying to use the fluidsynth driver. It first asked for all the dependent dll files (libglib-2.0-0, libgthread-2.0-0, intl), so I copied them all in the DOSBox directory. But the exe crashes every time I start it. :dead:

AND ANOTHER UPDATE: I tried compiling and using a shared fluidsynth library. This looks promising! :blush:

dosbox_ece_with_fluidsynth.jpg
My full-featured DOSBox SVN builds (without debugger) for Windows and Linux: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 202
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: Fluidsynth soundfont patch

Postby lukeman3000 » 2017-1-26 @ 15:05

Yesterplay, I noticed that you added a Fluidsynth build on your website recently. Did you get this figured out, and does the build play midi?
lukeman3000
Member
 
Posts: 129
Joined: 2009-3-17 @ 00:59

Re: Fluidsynth soundfont patch

Postby Yesterplay80 » 2017-1-26 @ 22:36

Yes and yes! ☺
My full-featured DOSBox SVN builds (without debugger) for Windows and Linux: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 202
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: Fluidsynth soundfont patch

Postby lukeman3000 » 2017-1-27 @ 05:53

Yesterplay80 wrote:Yes and yes! ☺

After I got home I downloaded your fluidsynth build onto my desktop and tried to run dosbox.exe. This is the error message I received:

Image
lukeman3000
Member
 
Posts: 129
Joined: 2009-3-17 @ 00:59

Re: Fluidsynth soundfont patch

Postby Yesterplay80 » 2017-1-27 @ 09:06

I don't have any idea why it asks for this file on your machine. I just tried my build on a completely new install of Windows 7 in a VM and it ran right from the start without asking for any other DLLs. I even searched the entire HDD for this file to make sure it isn't installed. So the problem doesn't seem to come from DOSBox. Maybe you already have another version of any of the provided DLLs installed that is looking for a libiconv-2.dll? Just in case, I'll attach the file it is looking for, just copy it in the DOSBox directory where you extraxted my build into.
libiconv-2.7z
(507.21 KiB) Downloaded 3 times

Does someone else have this this error, too?

UPDATE: It works on a fresh Windows 10 x64 as well here.
Last edited by Yesterplay80 on 2017-1-29 @ 02:31, edited 1 time in total.
My full-featured DOSBox SVN builds (without debugger) for Windows and Linux: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)
User avatar
Yesterplay80
Member
 
Posts: 202
Joined: 2016-2-23 @ 11:02
Location: Germany

Re: Fluidsynth soundfont patch

Postby lukeman3000 » 2017-1-27 @ 16:22

Strange. I tried your fluidsynth build on both my Windows 7 64-bit laptop and my Windows 10 64-bit desktop. Both gave me the same error.

I will try again file you attached and post the results when I get the chance.
lukeman3000
Member
 
Posts: 129
Joined: 2009-3-17 @ 00:59

Re: Fluidsynth soundfont patch

Postby collector » 2017-1-27 @ 21:16

I do not have the DLL on my Win7 Pro and have no problems with your build. I would have to reboot to test in Win10.
User avatar
collector
l33t
 
Posts: 3906
Joined: 2003-1-15 @ 10:39

PreviousNext

Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 2 guests