File interface for Fluidsynth

MIDI libraries can be a pain. In some cases, a simpler API is better. Device files are a simple way to expose MIDI devices, which is how OSS does it.

Playing raw MIDI data with fluidsynth

If you have a program generating a MIDI stream, you can play it back in Fluidsynth like so:

$ ./yourprogram | fluidsynth -is -a alsa \
    -o midi.driver=oss \
    -o midi.oss.device=/dev/stdin \
    /path/to/your/soundfont.sf2

This works because the OSS MIDI API is a device file that simply consumes and produces MIDI bytes as-is. An application using OSS could use another file stream as its source. Instead of stdin, one could read from a named pipe:

$ mkfifo /home/you/midipipe
$ ./yourprogram | fluidsynth -is -a alsa \
    -o midi.driver=oss \
    -o midi.oss.device=/home/you/midipipe \
    /path/to/your/soundfont.sf2

Reading/writing raw MIDI data as byte streams from/to devices

TBD, Alsa OSS emulation, amidi...

Quick notes about MIDI