fluadity   -   Synthesiser and midi-to-wav converter using the Fluidsynth library


 fluadity &               # a non-verbose alsa-client, o/p to soundcard
 fluadity -i ProKeys &        # likewise, and connects from the ProKeys
 fluadity -s ./Foo.sf2 -i Pro & # likewise, and loads Foo.sf2 soundfont
 fluadity -d                    # starts a daemon alsa-client Fluadity
 fluadity -d -c                 # starts a daemon in compatibility-mode
 fluadity /tmp/t.mid /tmp/t.wav # converts midi to wav
 fluadity /tmp/t.mid            # like aplaymidi -p TiMidity /tmp/t.mid
 fluadity - /tmp/t.wav          # like timidity -Ow -o /tmp/t.wav -
 fluadity -                     # like timidity -     
 perldoc fluadity               # read the manual :-)

 ~> cat ~/.fluidsynth
 set audio.driver alsa
 load /home/soundfonts/Chaos4m.sf2
 load /home/soundfonts/MyGM.sf2
 load /home/soundfonts/ReallyGoodPiano.sf2
 select 9 1 127 99


The name fluidity would be a great variant on timidity (which in turn is a magnificent variant of audacity), but 'fluidity' is already a one-person Nintendo video game, released 6dec2010.


So the name fluadity was chosen, since it also contains Lua which is the language it uses, and has no previous meaning, is easy to pronounce, and is highly searchable.

It is intended to have a much lower latency than timidity, so as to be good for real-time work. Its command-line is leaner and easier to remember than timidity's (which is however already pretty good). But it can only use SoundFonts, and so is less configurable.

It has similar functionality to the fluidsynth command, but is even easier to use, can run as a daemon, and features a convenient default configuration file ~/.fluidsynth or /etc/fluidsynth.conf

Since version 1.8 fluadity offers the cc66 sostenuto-pedal, and works around several quirks in the fluidsynth-library.   Raw fluidsynth-compatible behaviour can be restored with the -c option.

Since version 2.0 fluadity offers the cc126 controller which sets Monophonic mode, and the cc127 controller which restores Polyphonic mode. This behaviour is not very conformant to the rarely-used MIDI-standard behaviour :-(   but it is useful, and respects at least the names of these controllers.

It uses the midialsa and fluidsynth Lua modules, which in turn need the alsa and fluidsynth C-libraries and associated header-files. Because it uses the midialsa library, it feels most at home on Linux. In -d daemon-mode, it also needs the luaposix module.



Invokes Compatibility-mode.   By default, the fluidsynth library:

  1. does not implement the sostenuto-pedal cc66,
  2. when it reaches its maximum-simultaneous-notes limit it truncates the newest note rather than the oldest,
  3. and when it receives more than one note_on on a pitch, then the first note_off received truncates all those notes.
Since version 1.8, in daemon-mode the midi-events are adjusted to work around these quirks.
Therefore -c provides a compatibility-mode,   so that midi files which depend on the default fluidsynth behaviour continue to sound the same as they always have done.


Starts a daemon running an ALSA-midi client called   Fluadity   (note: upper-case F).
This can be invoked, for example, in   /etc/rc.local
In daemon mode the default configuration file is   /etc/fluidsynth.conf

Users can then set   export ALSA_OUTPUT_PORTS=Fluadity

-f  /wherever/my_fluidsynth_config

Reads the configuration from the given file. The default configuration file is   $HOME/.fluidsynth   or if that does not exist then   /etc/fluidsynth.conf
These are also the default config files for the fluidsynth executable.

This module only recognises set, load and select commands; see   man fluidsynth
In this example, the select command chooses for channel 9, from soundfont 1 (Chaos4m.sf2) the bank 127 patch 99, which happens to be a percussion set, as you typically want on channel 9.
This is the format:

 set audio.driver alsa
 set synth.polyphony 1024
 load /home/soundfonts/Chaos4m.sf2
 load /home/soundfonts/MyGM.sf2
 load /home/soundfonts/ReallyGoodPiano.sf2
 select 9 1 127 99
-i  ProKeys,Keystation

Starts an ALSA-midi client called   fluadity   which it connects from (in this example) the ProKeys and Keystation midi-keyboards.
In this mode, fluadity terminates when all its inputs disconnect.
Of course it terminates also if killed or interrupted (eg: with ctrl-C twice), but in this case it leaves a temporary file undeleted in /tmp containing all the library's stderr output.

-s  /home/soundfonts/Wierd.sf2 -s Gulp.sf2

This loads a soundfont from the command-line, and ignores all the soundfonts in the config file.
Multiple -s options may be given.


Prints the Version


 20200523 2.3  use the read('* arguments for lua 5.2 and before
 20181024 2.2  play_midi fixes truncate-sound-on-first-noteoff quirk
 20181023 2.1  midi2wav fixes fluidsynth's truncate-sound-on-first-noteoff quirk
 20160224 2.0  in daemon mode: interprets cc126 as Monophonic, 127 as Polyphonic
 20150413 1.9  handles notes-off and sounds-off events and disconnects correctly
 20150206 1.8  in deamon mode: sosped, maxnotes=20, and nested note_ons
 20140904 1.7  if -s is given, use the fluidsynth.lua 1.7 syntax
 20140903 1.6  if -s is given, still read the non-'load' config lines
 20140903 1.5  as daemon, sighandler now works also before a synth starts
 20140901 1.4  as daemon, only run a synth while there are connections
 20140831 1.3  add -d daemon option
 20140829 1.2  remove the TmpFile stuff, now fluidsynth understands '-'
 20140825 1.1  first working version


Fluadity is available at:


Just move it into your PATH, make it executable, and if necessary edit the first line to match where Lua is installed on your system.

You will also need the fluidsynth, midialsa, MIDI and luaposix modules:

 luarocks install fluidsynth
 luarocks install midialsa
 luarocks install midi
 luarocks install luaposix




Peter J Billam, http://pjb.com.au/comp/contact.html