VOGONS


Fluidsynth soundfont patch

Topic actions

Reply 20 of 79, by truth_deleted

User metadata

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

  • Filename
    dosbox-3-GM-reverb.zip
    File size
    1.79 MiB
    Downloads
    352 downloads
    File comment
    dosbox-r3871+fluidsynth-reverb (win32)
    File license
    Fair use/fair dealing exception
  • Filename
    dosbox-fsynth-3-reverb.diff
    File size
    7.24 KiB
    Downloads
    267 downloads
    File comment
    fluidsynth-reverb patch for dosbox-r3871
    File license
    Fair use/fair dealing exception

Reply 21 of 79, by bloodbat

User metadata
Rank Oldbie
Rank
Oldbie

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.

Reply 22 of 79, by truth_deleted

User metadata

😀

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

  • Filename
    fluidsynth_update.zip
    File size
    138.13 KiB
    Downloads
    337 downloads
    File comment
    fluidsynth update (version 9/24/14)
    File license
    Fair use/fair dealing exception

Reply 23 of 79, by bloodbat

User metadata
Rank Oldbie
Rank
Oldbie

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:

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

Reply 24 of 79, by dugan

User metadata
Rank Newbie
Rank
Newbie

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

  • Filename
    fluidsynth_wordexp.diff
    File size
    11.3 KiB
    Downloads
    157 downloads
    File license
    Fair use/fair dealing exception

Reply 25 of 79, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

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:

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:

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: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)

Reply 28 of 79, by Kisai

User metadata
Rank Member
Rank
Member
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 i […]
Show full quote

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:

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:

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.

#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

Reply 29 of 79, by gdjacobs

User metadata
Rank l33t++
Rank
l33t++
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).

All hail the Great Capacitor Brand Finder

Reply 30 of 79, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie
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: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)

Reply 31 of 79, by James-F

User metadata
Rank Oldbie
Rank
Oldbie
Yesterplay80 wrote:

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

Falcosoft Soundfont Midi Player + Munt VSTi + BassMidi VSTi
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.


my important / useful posts are here

Reply 32 of 79, by Kisai

User metadata
Rank Member
Rank
Member
Yesterplay80 wrote:
I went back until 1.0.9, but none would work. […]
Show full quote
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.

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

Reply 33 of 79, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

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/wiki/BuildingWithCMake/
  • 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:

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:

#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

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

#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. 😵

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

dosbox_ece_with_fluidsynth.jpg
Filename
dosbox_ece_with_fluidsynth.jpg
File size
91.27 KiB
Views
5703 views
File license
Fair use/fair dealing exception

My full-featured DOSBox SVN builds (without debugger) for Windows: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)

Reply 37 of 79, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie

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.

Filename
libiconv-2.7z
File size
507.21 KiB
Downloads
96 downloads
File license
Fair use/fair dealing exception

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-01-29, 02:31. Edited 1 time in total.

My full-featured DOSBox SVN builds (without debugger) for Windows: Vanilla DOSBox and DOSBox ECE (Enhanced Community Edition)

Reply 38 of 79, by lukeman3000

User metadata
Rank Member
Rank
Member

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.

Reply 39 of 79, by collector

User metadata
Rank l33t
Rank
l33t

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.

The Sierra Help Pages -- New Sierra Game Installers -- Sierra Game Patches -- New Non-Sierra Game Installers