MIDI on Linux is highly modular and, as a result, initially overwhelming. It's nice to have a low-complexity solution working before you bother with optimizations, but unfortunately Ubuntu doesn't come with a default working configuration. Here's the simplest way that I have found...
sudo apt install qsynth vmpk ## install components
qsynth & vmpk ## launch
Qsynth -> Setup -> Sountfonts -> Open
: FluidR3_GM.sf2
Virtual MIDI Piano Keyboard -> Edit -> Connections
->
Enable MIDI Thru on MIDI Output
: (checked)
Input MIDI Connection
: (Your Controller)
Output MIDI Connection
: FLUID Synth
At this point, you should be able to play notes from either your external MIDI controller or from the virtual piano GUI (the GUI works even if you don't have an external controller).
From the Keyboard GUI you can select different instruments (see Program
). From the Qsynth GUI you can manipulate the volume (see Gain
) as well as Reverb/Chorus effects. There is also a Panic
button in case the reverb goes off the rails.
This was specifically tested on clean install of Ubuntu Studio 18.04, but similar steps worked for Ubuntu MATE 16.04, with a notable automatic configuration difference being that Qsynth -> Setup -> Audio -> Audio Driver
defaulted to jack
in Ubuntu Studio but to alsa
on Ubuntu MATE.
Glitchy static with ALSA [SOLVED]
On both 16.04 and 18.04, I have experienced weird static when Qsynth initially starts working with alsa. This static seems to affect all audio sources, but it somehow works itself out in a minute or two (at least partially).
I later tried this setup on a less powerful CPU and noticed a similar static that did not seem to resolve over time. [As an aside, I noticed that this static correlated with the ALSA plug-in [qsynth]
line glitching in and out in the Applications tab of Sound Preferences
].
This led me to play around with some Qsynth Settings, and I found something that seems to solve both static/glitch problems (maybe with a trade-off of a minor latency increase):
Qsynth
-> Setup
-> Audio
-> Buffer Size
: 128
Qsynth
-> Setup
-> Audio
-> Buffer Count
: 8
Apparently, the CPU can't always keep up with the required burst rate, so a little extra buffering is needed to prevent underruns. Presumably the are other settings that could also affect this.
vmpk
loses its connection to Qsynth
when the settings are changed. The quickest way to experiment with changing settings is to close and restart vmpk
to force a reconnect.
Alternative: "Polyphone" application (not in Ubuntu repositories)
I've got my eye on Polyphone as a (nearly) all-in-one solution (essentially a superset of qsynth+vmpk). Although it isn't in the Ubuntu repositories so far (as of 19.04 Disco), it was easy to build from source on 18.04 (also, there is a pre-built Ubuntu .deb provided).
The package doesn't include a default soundfont (it is a soundfont creator/editor), but you can get one with sudo apt install fluid-soundfont-gm
(at /usr/share/sounds/sf2/
) -- or try downloading from the application's "Online repository" (but this may require an account).
Go to Settings->General->Input/Output
and make sure the Audio/MIDI settings are sensible, then open a soundfont and select an instrument under Presets
and it should be ready to play music from your MIDI controller, or from the built-in virtual keyboard.