Improving Your Linux System

By improving your system, we are referring to having high-quality sound, and synthesizers with low-latency, producing that high-quality sound.

If you haven't yet looked at the general improvements that are applicable to all operating systems, please click the following link:

Improving Your System - All Operating Systems

With Linux, you are fortunate because there are a variety of components for improving your system, and probably all of them are available for free.

Because of this, the automated installation process (for installing the Help and Tutorials) is able to also install a lot of useful components for you.

So if you haven't already done so, do the installation step for installing the Help and Tutorials, and then read-on to learn what they are, and how to use them.

In improving your system, there are two ways we accomplish it:

  1. Improving Sound Quality

  2. Reducing Latency

Latency is the delay between hitting a key, and hearing the musical tone that key produces. Latency makes it difficult to play fast tempo music. The greater the latency, the greater the difficulty. In using the Java Sound (Gervill) synthesizer up to this point, you have already experienced the difficulties latency can cause, and will therefore by motivated to reduce or eliminate it.

Sound quality is the difference between the sound of an upright piano (as is found in many homes), and a concert grand piano costing thousands of dollars.

With Linux (at least, with Ubuntu Linux), you get the concert grand piano for free. By saying this, I mean that it comes with two really excellent soundfonts (collections of instrument sounds), for free. These two soundfonts, along with their uses and relative merits, are discussed below.

We will deal with improving sound quality first, since it is the easiest to address.

Improving Sound Quality

One big change you can make in improving sound quality, is to use a better soundfont than is used by default. Two such soundfonts are generally available in the repositories. These are included as 'recommended' dependencies, which can be installed by (in the Installing on Linux page) installing the 'Normal' dependencies.

FluidR3_GM.sf2 (Fluid Release 3 General-MIDI soundfont, by Frank Wen)

This soundfont comes in the “fluid-soundfont-gm” package. If your distribution of Linux doesn't include this package, you can download the soundfont yourself from the member pages at:

FluidR3_GM Soundfont

This is, in my opinion, one of the best soundfonts available. It is so good that I even supply two configuration files tailored to it (FluidR3_GM.kmk and FluidR3_GM-2.kmk). The only problem with using it, is its large size (142 megabytes).

If you have more than 512 megabytes of RAM (computer memory), you can use it at-will on Linux, including in the Java Sound synthesizer. If you have only 512 megabytes of RAM on your machine, you will only be able to use it for loading into a soundcard with a hardware synthesizer, or with Qsynth, or Fluidsynth. With only 512 megabytes of RAM, you can't use it with the Java Sound synthesizer.

Even to use it for loading into a soundcard's hardware synthesizer, a change is needed to your system configuration, allowing the use of large soundfont files to be loaded into soundcards. With any of the Ubuntu Linux systems, this change has been made for you, but it doesn't take-effect until the next time you boot your system after installing the extra components.

With other Linux distributions, you may have find out how to configure the limit on the size of soundfonts. On SUSe Linux, there is a YAST configuration under the “Sounds” category, allowing the large soundfonts. You can tell if your system needs this configuration change, if some instrument sounds play, but others (the oboe, for example) do not play (remain silent).

If you have enough computer memory (RAM) to use it, you should use this soundfont extensively before looking for other soundfonts.

If you use it, you should use one of the configuration files provided, that were customized for it, as shown in the following screenshot, showing you how to select it:


The “DefaultLinux.kmk” configuration file (which was used initially, and has probably been carried-forward in your “PriorConfig.kmk” configuration) is tailored to the limitations of the default soundfont of the Java Sound (Gervill) synthesizer supplied by Open Java for Linux.

Since these files have to work for Mac, Windows, and Linux, and to avoid cases on Linux where use of the Java Sound (Gervill) Synthesizer conflicts with using JACK, there is no MIDI output device configured in these files. You will have to specify the device you intend to use the first time you use it, then use the “Save Config” button to save it to the same file (so you don't have to do it again).

As with any soundfont, you should explore all of the instrument-sounds it provides, to discover which sounds you like best. The configuration file selected above will demonstrate a few of my favorites, which are made use of in the tutorials. I particularly like the piano, oboe, steel-string guitar, cello, and space-voice (choir pad) sounds in this soundfont.

TimGM6mb.sf2 (the Timidity General-MIDI 6-megabyte soundfont)

This soundfont comes in the “musescore-soundfont-gm” or “timgm6mb” package.

In cases where you need to conserve computer memory (RAM), this is an excellent soundfont to use. But beyond that, some of its solo-instrument sounds (notably, trumpet, oboe, and flute) are so good you may want to use it anyway. But in general, the FluidR3_GM.sf2 is better.

The customization of the configuration file “FluidR3_GM.kmk” (selected in the screen-shot above) also applies to this soundfont. The exception to this is that in the “F5” performance pane, you probably should substitute the “Cello” sound instead of the French Horn, which has some problems (I think) in this smaller soundfont.

This smaller soundfont can be used anywhere a soundfont is required, whether for the Java Sound (Gervill) synthesizer, for loading into soundcards having a hardware synthesizer, or for use with Qsynth or Fluidsynth. You should certainly use it in preference to the default Java Sound soundfont.

Reducing Latency

You can reduce latency by using hardware synthesizers (such as the synthesizers on a Soundblaster Live sound-card), or external synthesizers connected to your computer via a USB or MIDI cable.

If your computer has a sound-card that has hardware synthesizers, you are fortunate, because these have very low latency, and don't burden your machine's processor the way software synthesizers do. This is somewhat old technology, so nowadays, you are unlikely to have such a sound-card, but if you do, this section will be very useful.

Click the link below if you think you might have such a sound-card on your computer:

Using A Soundcard Having Hardware Synthesizers

Initially, you probably started out using the “Java Sound Synthesizer”, which is a software synthesizer. Depending on the soundfont loaded, it can have good quality sound. But it has a little too much latency.

Fortunately, there are other software synthesizers that have much less latency.

One of the best low-latency software synthesizers available, is Fluidsynth, along with its Graphical-User-Interface (GUI) Qsynth. Associated with these components, is the Jack Audio Connection Kit (JACK), which allows you to connect audio and MIDI components together in the software, without the need of cables.

If you have a laptop, or if you can't obtain a sound-card having a hardware synthesizer, Qsynth (Fluidsynth) is your best choice. It has a bit more latency than a sound-card with a hardware synthesizer, but definitely less latency than the Java Sound synthesizer you have been using up to this point. On the plus-side for it, it actually sounds a little better than even the hardware synthesizers in a sound-card.

It does require a somewhat fast machine. Basically, if the Java Sound synthesizer works on your machine, Qsynth/Fluidsynth will work even better. On my test machines, it works fine on a 900 megahertz speed machine, and I have made it work okay on a 450 megahertz machine whose CPU includes a Floating-Point Unit (FPU). I do use JACK (rather than PulseAudio) on slow machines, since it runs a lot more efficiently that way.

Qsynth/Fluidsynth normally comes with the FluidR3_GM.sf2 soundfont, and works well with it.

If you are using one of the versions of Ubuntu Linux (Ubuntu, Ubuntu-Studio, Lubuntu, Kubuntu, or Xubuntu), the automated install makes configuration changes for you, that allow Qsynth/Fluidsynth to perform well, even on slower machines. These configuration changes don't take-effect until the next reboot, though.

If you have less than 512 megabytes of RAM, you will have to use the smaller TimGM6mb.sf2 soundfont. With only 512 megabytes of RAM, in order to have more than one Qsynth engine (or a second copy of Fluidsynth running), at least one of them will have to use the small (TimGM6mb.sf2) soundfont.

On SUSe Linux, Fluidsynth was available (but with no soundfont), and its GUI interface (Qsynth) was not available. You can get around that by obtaining FluidR3_GM.sf2 from the link below:

Obtain the FluidR3_GM Soundfont

After doing that, run Fluidsynth from a terminal-window. The KeyMusician Keyboard can connect to instances of Fluidsynth running in a terminal-window just fine. JACK (the qjackctl package) was available on SUSe, but not needed.

Another good, low-latency synthesizer available from the Linux repositories, is zynaddsubfx (ZynAddSubFX). It has a wide variety of good sounds. It does seem to need faster processor than Qsynth/Fluidsynth, so if you have a slow machine, it won't be an option.

We will discuss the use of Qsynth/Fluidsynth first, then the use of ZynAddSubFX.

Setting-Up Qsynth To Run On Your System

Though Qsynth normally uses the Jack Audio-Connection Kit (JACK) by default, in most cases, it will work without it, using PulseAudio, ALSA, or whatever sound system your Linux system uses. On the various 'flavors' of Ubuntu Linux, the PulseAudio Sound Server is used (and the Java Sound synthesizer depends upon it). So you can start out by configuring Qsynth to use PulseAudio, rather than JACK.

It is reasonable to first try this approach, since this way, you only need to fire-up Qsynth (instead of both Qjackctl and Qsynth). If you run into cases where the sound briefly 'cuts-out', we tell you later in this web-page how to change it to use JACK (Qjackctl), and how to set up Qjackctl.

Once installed (as you did when you installed the Help and Tutorials), you find Qsynth in the “Audio Production”, “Sound & Video” or “MultiMedia” area of the application menu. On Ubuntu-Studio (which is the version of Ubuntu specifically tailored for audio production), it is found in the “Audio Production” … “Sound Generators” area of the menu. Click on it to run it. You might want to put its icon on your desktop, or in the application-launcher part of your panel. The way you do that depends on which Linux distribution you use.

When you click on it, selecting it to be run, the Qsynth window will appear, looking much like the following (without my custom blue green colors):


On mine (shown above), notice that the “Chorus” settings (to the right of center) are grayed-out.

Unless you have a fast machine, and really want your music to sound like several instruments playing together (a chorus of instruments), it is a good idea to disable the “Chorus” settings on your machine as well, since disabling it reduces the processor load. You disable the Chorus feature by clicking on the “Active” check-box below the “Chorus” settings, which un-checks the check-box.

You can also get a little better performance on a slower machine, by disabling the “Reverb” controls in a similar manner.

To configure Qsynth for the tab selected/highlighted below (Qsynth1, in my case), click on the “Setup” button (on your machine), as pointed-to by the cursor in the picture above.

A window like the following will appear. Note that it has several tabs going across, near the top. The “MIDI” tab is initially displayed.


Important: In the “MIDI” tab, click on the “MIDI Client Name ID” drop-box, and choose “Qsynth1” from it, as shown in the picture above. It will make your Qsynth device name more predictable in drop-boxes where you choose a device in the KeyMusician Keyboard. It will also allow it to be restored when a configuration using it is loaded.

Next, click on the “Audio” tab (highlighting it as shown below):


Notice that the “jack” audio driver is selected by default in the drop-box the cursor points to. JACK is a much more efficient audio driver than what is used normally in the system, and is required if you are using the Rosegarden sequence-editor and audio-editor. If your system is slow, you may need to use JACK to avoid audio drop-outs.

So if you need (or plan) to use JACK, leave it set specifying “jack”. Otherwise, click on it, and select “pulseaudio” instead.

A bit lower in the dialog, on its right side, is a spin-control called “Polyphony”, with a value of “256” in it. Unless you have a very fast machine, change it to “64” (as shown above). On a slow machine (or if your sound cuts-out), a value of “48” will be better.

Next, click on the “Soundfonts” tab, which will change the dialog to look something like the following:


On your machine, the first time you configure it, there will be no soundfonts selected. Click on the “Open” button (where the cursor is pointing in the picture above).

It will show you all of the soundfonts in the folder your Linux system expects them to be in. If your computer has at least 512 megabytes of RAM (memory), select the “FluidR3_GM.sf2” entry. Otherwise, select the “TimGM6mb.sf2” entry.

Click the “OK” button to cause your configuration changes to take-effect. It will ask you if you want to restart the fluidsynth engine now. To avoid cases which could hang your system (where you changed from using “jack” to “pulseaudio”), click the “No” button.

Now, click the “Quit” button of the Qsynth window, which will result in the configuration being changed without a chance of hanging the system.

You should be able to fire-up Qsynth (from the application menu, as you did earlier to configure it), and the new settings will now take-effect.

You can then fire-up the KeyMusician Keyboard, and you should see Qsynth as one of the MIDI output devices you can select for output, as shown in the screen-shot below:


If the KeyMusician Keyboard was already running when Qsynth was started, it won't be available in the list, because the list is created when the KeyMusician Keyboard is started.

To include any MIDI devices or interfaces connected (or started) after the KeyMusician Keyboard was started, click on the “Refresh” button of the “F1 Help/Setup” pane, and wait for the button to un-toggle (no longer be highlighted). Then you can click on the “MIDI Output To” drop-box, and see the new devices or interfaces.

Adding An Additional Qsynth Engine

Since it is useful to have the integrated MIDI player use a different synthesizer than the one the keyboard uses, it's a good idea to configure that extra synthesizer by adding an additional Qsynth engine.

You add an additional Qsynth engine by clicking on the “+” button in the lower-left portion of the Qsynth window, as shown in the screen-shot below:


When you do that, a new tab will appear to the right of your existing engine (Qsynth1, in my case above). It will be named Qsynth2, as appears above.

With the “Qsynth2” tab highlighted, click on the “Setup” button to configure it, in the same manner as you did before, except with the following changes:

Again, it is a good idea to disable the “Chorus” controls (and possibly also the “Reverb” controls) if you have a slower machine. Be aware that all of the visible controls affect only the currently-highlighted engine tab.

The “Gain” knob is the volume control for the particular engine.

Having done all this, you now should be ready to use the low-latency Qsynth (Fluidsynth) synthesizer!

If in using it, you sometimes (or often) encounter cases where the sound produced by it 'cuts-out', or if you want to use Qsynth with JACK so you can use JACK with a sequence-editor (such as MusE, or Rosegarden), click on the link below to learn how:

Configuring Jack, And Changing Qsynth To Use It

Setting-Up ZynAddSubFX To Run On Your System

ZynAddSubFX is a good, low-latency software synthesizer, available to be installed on Linux as a Debian package, called zynaddsubfx. Unlike Qsynth and Fluidsynth, it does not use soundfonts (sampled sounds), but entirely synthesizes the sounds it produces.

It is included in the normal (and extras) dependencies package, used to cause the installation of additional software components.

It is classified as an audio, and audioVideo application, so you will find it in the start-menu under “Sound & Video” (on Lubuntu), and “Audio Production” (on UbuntuStudio).

It will work with either PulseAudio (ALSA), or JACK (qjackctl). We will show you how to set up a desktop launcher for it (on Lubuntu) to run it either way (PulseAudio, or JACK). Setting up a desktop launcher in other Linux distributions will be similar, but different.

Click the link below to learn how to set-up and use the ZynAddSubFX software synthesizer.

Setting-Up And Using ZynAddSubFX

Using Rosegarden

Rosegarden is a sequence-editor and audio-editor, with extensive editing capability in music notation. It can also edit music in 'piano-roll' graphic form.

Using Rosegarden as a sequence-editor gives you a quantum-leap in music recording capability, above what is included with the KMK MIDI Player / Recorder.

Surprisingly, it is also a good platform for using the KeyMusician Keyboard in live performance – even including the capability of doing composite voices, without the need of multiple Qsynth 'engines'.

To learn all about using Rosegarden with the KeyMusician Keyboard, in the KeyMusician Newsletter, click on the link below:

Using Rosegarden With The KeyMusician Keyboard



(Use your browser's 'back' button to return to where you came from)