Fluidsynth is a longstanding standard software tool, multiplatform, which takes MIDI signals as input and gives tones as output in response, according to the specifications within soundfonts. There are General MIDI soundfonts which give a very standardized, very wide variety of instruments, and a huge number of other soundfonts which give just a few or a small collection, and even also large non-standardized collections, e.g., for orchestral and/or rhythmic use.
But Fluidsynth is a non-GUI tool. Very nearly all of the documentation I have found for using soundfonts in Linux, does not touch Fluidsynth directly, but instead describes a tool called Qsynth, which is the most common GUI front-end used with Fluidsynth. For my purposes, Qsynth is the cat's meow for studying soundfonts, getting the list of available sound-specs within, testing them, etcetera; but I need a high degree of well-documented automation. So I developed this fairly simple method of using Fluidsynth in a X/terminal window, mostly by puzzling out the options on the man page and testing.
When I start Fluidsynth from command prompt or script, I use a line like this:
nohup xterm -T "FluidSynth Strings" -e schedtool -R -p 50 -e /home/username/FLUIDSYNTH/run-fs-Strings &
Here is what it does:
The script run-fs-Strings, located in the FLUIDSYNTH storage area, is as follows:
#!/bin/bash cd /home/username/FLUIDSYNTH schedtool -R -p 50 -e fluidsynth -a jack -C no -K 1 -l -m alsa_seq -R no -s -v \ -o audio.jack.id=StringsFS -p StringsFS -f Strings.fs
'run-fs-Strings' actually runs fluidsynth, reconfirming the high priority with schedtool; but it sets several things. Here is a rundown:
-a is the audio driver. Fluidsynth is capable of delivering audio out using several different methods.
-C is a chorus effect. Default is on, I want it off, I want effects to come through GUI tools set up in other ways.
-K sets up the number of MIDI input ports.
Disables the 'lash' automatic session system. I might use it if there was a lot more documentation out there, but there's not, so I rolled my own.
Sets the method to get MIDI input. I am using ALSA, which seems to be the best-supported and most nearly realtime; there are others.
-R is a reverb effect. Default is on, I want it off, I want effects to come through GUI tools set up in other ways.
-s starts Fluidsynth as a server process, and -v is verbose mode, it will show the MIDI events as they come.
This sets the name of this Fluidsynth instance in the Jack patchbay. This is important if you plan to sometimes run more than one Fluidsynth at a time.
This sets the name of this Fluidsynth instance in the ALSA MIDI system. Also important if you plan to sometimes run more than one Fluidsynth at a time.
And -f gives us the ability to set several parameters in Fluidsynth's interactive shell capability. The command line was getting too long Actually there are parameters (e.g., audio.jack.id above!) which are important to set before Fluidsynth runs, i.e., before the shell capability exists, and there are several which are easier to study, contemplate, and verify as a list of shell commands, so this approach ends up helping the understanding of all of this, even though it's yet another step!
So in this case, my general Strings setup, I use the following as /home/username/FLUIDSYNTH/Strings.fs:
load "/home/username/SOUNDFONTS/Cadenza Strings.SF2" prog 0 5 set synth.gain 0.08
One of the many wonderful aspects of Fluidsynth, is the fact that almost all of its enormous command-set can be entered manually in the window we have created, after it is running. The synth.gain setting above is amazingly low, but it is what I have found that I need, even though I don't know why! The prog setting is different, that is discovered using Qsynth as follows:
The prog setting chooses which tone definition inside the current soundfont, is to be used. The Fluidsynth default is often not the one you will want. I do this using Qsynth. Qsynth's default screen is this:
Open your soundfont file, choose the “Channels” button, and you'll get something like this:
You'll notice columns named “Bank” and “Prog”; for this configuration, which is my Strings patch, I want the ensemble, which is Bank 0 and Prog 5. Thus it is that in my Strings.fs, the prog line is “prog 0 5”.