VOGONS

Common searches


FluidSynth MIDI driver

Topic actions

First post, by mgiuca

User metadata
Rank Newbie
Rank
Newbie

Hi,

I was getting sick of having to manually start up FluidSynth and connect DOSBox to it (through ALSA, on Linux, for example). So I got around to writing a FluidSynth driver for DOSBox, so it can directly send MIDI commands to FluidSynth via its own API. For those who don't know what this is, it's a MIDI synthesiser that turns DOSBox's MPU-401 MIDI commands into sound.

Its usage is pretty simple, you just set this in the [midi] section:

mididevice=fluidsynth
midiconfig=audio_driver:soundfont

for example, on Linux, I might have:

mididevice=fluidsynth
midiconfig=pulseaudio:/usr/share/sounds/sf2/FluidR3_GM.sf2

Then, all DOSBox MPU-401 games will automatically produce sound without having to start up any extra software. (I don't have many MPU-401 games, but King's Quest VII requires some external MIDI synth, and this works for that game.)

I have found a year-old forum post here with a similar patch, that doesn't appear to have been accepted. So perhaps I am wasting my time, but since I wrote my patch, I may as well post it here. My patch looks simpler than that one -- it doesn't create a whole event structure, it just passes the messages directly to FluidSynth API calls. The whole driver is 137 lines.

I am maintaining the patch in a Bazaar branch on Launchpad here. The full patch is here: download. I am also attaching the patch to this post.

I am not sure how hard it is to get MIDI games working in DOSBox under Windows -- perhaps someone can explain what the process is like. But under Linux, it is quite a pain if you don't have a hardware synth, requiring that you set up a separate MIDI synth. Hopefully, this patch will make it much easier to get MIDI games working. Unfortunately, it still requires that the user configure the driver name and specify the path to the soundfont, but at least that can be done on a once-off basis.

Attachments

  • Filename
    fluidsynth.diff
    File size
    10.67 KiB
    Downloads
    252 downloads
    File comment
    Patch to add FluidSynth driver to DOSBox.
    File license
    Fair use/fair dealing exception

Reply 1 of 33, by mgiuca

User metadata
Rank Newbie
Rank
Newbie

A quick update: made it so the FluidSynth driver is tried LAST, instead of FIRST.

This page will always contain a link to the up-to-date patch.

Attachments

  • Filename
    fluidsynth.diff
    File size
    10.74 KiB
    Downloads
    243 downloads
    File comment
    Updated diff.
    File license
    Fair use/fair dealing exception

Reply 2 of 33, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Thanks for your effort. If I had any say in Dosbox I'd accept this patch 😉

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 5 of 33, by VileR

User metadata
Rank Oldbie
Rank
Oldbie

I wouldn't assume that it was rejected, as there hasn't been an official DOSBox release since you put up the patch.

Don't know why it wasn't moved to the patches forum, though - would be nice to have it where more people would notice and get the chance to test.

EDIT: ah, there it is. :)

Reply 6 of 33, by Ocean112

User metadata
Rank Newbie
Rank
Newbie

I've been using ykhwong's build of dosbox which I'm assuming includes this patch. Is there anyway to set the gain of fluidsynth in the config options? Looking at the code on the lauchpad I can't see it. If it isn't, adding in an option to set the gain in the conf file with the rest of the midi options would be great. Especially as all soundfonts aren't recorded at the same level. If I'm being an idiot and a gain option is already included, please inform me as to how. I saw in one of the old fluidsynth topics where a setting might have been implemented as synth.gian=* but I tried that to no success. Short of re-doing the soundfont I would like to use and upping the base magnitude all around I don't see any other way to go about it, other than a volume control attached to the entire midi section.

Reply 7 of 33, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

The patch doesn't mention gain in any way, so...

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 9 of 33, by Ocean112

User metadata
Rank Newbie
Rank
Newbie

That's to be expected really, as most soundfonts, while having a common recording amplitude inside each "font", they can differ greatly between them. Each soundfont would have a different "best" gain setting associated with it (to match the volume of the emulated digital audio). It just depends on how and who sourced the samples. (and how they prepared them for the pack) Thanks for the help though.

EDIT: As a side-note though, I had to make the 20120701 build large address aware for the SGM and Crisis soundfonts that I tried work. Probably something everyone's already aware of but if you don't well, there you are.

Reply 10 of 33, by dnewhous

User metadata
Rank Member
Rank
Member

I just figured a reason why they can't make Fluidsynth for Windows - it would conflict with whatever they are installing in DOSBox -X.

Daniel L Newhouse

Reply 11 of 33, by darry

User metadata
Rank l33t
Rank
l33t
dnewhous wrote on 2021-03-10, 04:36:

I just figured a reason why they can't make Fluidsynth for Windows - it would conflict with whatever they are installing in DOSBox -X.

Fluidsynth is available for Windows as a set of pre-compiled binaries (if you don't feel like building from source). https://github.com/FluidSynth/fluidsynth/releases/tag/v2.1.7

EDIT : You might want to try this http://vkiller2k.users.sourceforge.net/devpro … nthGUI/main.php to make config. and usage easier .

If you want to use FluidSynth under Windows (presumably 10) :

a) Get and install LoopMIDI and then create a loopback MIDI port
b) Install Qsynth (FluidSynth is bundled with it)
c) Launch Qsynth and load a soundfont
d) Set MIDI output port to loopMIDI in your favorite MIDI playing app/game OR use MIDISelector4.0 (or an equivalent) to set default MIDI port to loopMIDI
d) Use the MIDI playing app/game to your liking .

Note: the loopMIDI port you created will only keep existing as long as LoopMIDI is running .

Reply 12 of 33, by dnewhous

User metadata
Rank Member
Rank
Member
darry wrote on 2021-03-10, 05:37:
If you want to use FluidSynth under Windows (presumably 10) : […]
Show full quote

If you want to use FluidSynth under Windows (presumably 10) :

a) Get and install LoopMIDI and then create a loopback MIDI port
b) Install Qsynth (FluidSynth is bundled with it)
c) Launch Qsynth and load a soundfont
d) Set MIDI output port to loopMIDI in your favorite MIDI playing app/game OR use MIDISelector4.0 (or an equivalent) to set default MIDI port to loopMIDI
d) Use the MIDI playing app/game to your liking .

You need to make Qsynth before you can install it. Thank heavens for WinRAR - it works better with any tar (tape archive). I got a little ways with CMake and reading readme.CMake. The build directory is superfluous. I got a build done with the "release" rather than the "debug" stipulation, and a Visual C++ project is built. I tried build and I get this - nothing.

Unix 101, you are supposed to zip before you tar. You are not supposed to see a double extension. The analogy is reel to reel storage. Of course there can be more than one zip file in a tar file. This is a UNIX anachronism. Gzip compresses files individually rather than produce a single zip file. That is why you need to tar it. I.e., gzip does not behave like Winzip on Windows. IIRC Solaris was more powerful than that. Wikipedia says that Solaris is the only POSIX certified operating system that anyone has ever heard of. What is cygwin imitating? Is it Ubuntu? “Bash on Ubuntu on Windows” That's what they're using as the standard for the examples online. That's what made Ubuntu popular.

Oracle Solaris defaults to the Korn shell.

Attachments

Last edited by dnewhous on 2021-03-24, 23:38. Edited 7 times in total.

Daniel L Newhouse

Reply 13 of 33, by darry

User metadata
Rank l33t
Rank
l33t
dnewhous wrote on 2021-03-10, 07:47:
darry wrote on 2021-03-10, 05:37:
If you want to use FluidSynth under Windows (presumably 10) : […]
Show full quote

If you want to use FluidSynth under Windows (presumably 10) :

a) Get and install LoopMIDI and then create a loopback MIDI port
b) Install Qsynth (FluidSynth is bundled with it)
c) Launch Qsynth and load a soundfont
d) Set MIDI output port to loopMIDI in your favorite MIDI playing app/game OR use MIDISelector4.0 (or an equivalent) to set default MIDI port to loopMIDI
d) Use the MIDI playing app/game to your liking .

You need to make Qsynth before you can install it. Thank heavens for WinRAR - it works better with any tar (tape archive). I got a little ways with CMake and reading readme.CMake. The build directory is superfluous. I got a build done with the "release" rather than the "debug" stipulation, and a Visual C++ project is built. I tried build and I get this - nothing

Here is a link to Windows binaries :

https://sourceforge.net/projects/qsynth/files … up.exe/download

Reply 14 of 33, by dnewhous

User metadata
Rank Member
Rank
Member

I think a Windows version would interfere with the licensing agreement for the Microsoft GS Wavetable synth, which is why this software isn't working.

Daniel L Newhouse

Reply 15 of 33, by darry

User metadata
Rank l33t
Rank
l33t
dnewhous wrote on 2021-03-11, 19:38:

I think a Windows version would interfere with the licensing agreement for the Microsoft GS Wavetable synth, which is why this software isn't working.

I have no idea what licensing agreement you are referring to. Microsoft does not force you to use any Softsynth or hardware synth via MIDI (though with the removal of MIDI mapper, you need third party utility to use something other than the default crappy, IMHO, Microsoft GS synth if your application only allows using the default MIDI device).

There are plenty of free and commercial softsynths for Windows and there have been for decades.

With the procedure I described, Fluidsynth works fine for me under Windows 10 x64 and I did not need to compile anything .

If you need assistance or more details with any of the steps I listed, please feel free to ask .

Reply 17 of 33, by _Rob

User metadata
Rank Member
Rank
Member

I don't understand what your trying to accomplish. Your messages are very short and often don't seem to make much sense. Although this may simply be a language issue...

In any case, DOSBox-X has integrated support for both MT-32 (via Munt) and FluidSynth for the Windows builds. You don't need to use an separate software MIDI synth. But if you want to use a separate software MIDI synth, or even a real hardware MIDI synth, you can.

Reply 18 of 33, by Wengier

User metadata
Rank Member
Rank
Member

As Rob already stated, Windows builds of DOSBox-X have built-in support of FluidSynth MIDI driver. Set mididevice=fluidsynth and a sound font (via fluid.soundfont option) to enable the built-in FluidSynth feature. A DOSBox-X Windows build that enables the FluidSynth MIDI driver by default is also available from here.