Improving Your Linux System For Creating Music

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 is a wide variety of components available for improving your system.

Here is a list of these components (in alphabetical order, by package name) that you should look at installing, which will (or may) be useful in creating music:

Before proceeding with this documentation, look over the list above, and install the packages that you think might be useful for you. In order to proceed, you will need to have installed the following packages:

That being taken care of, we now proceed with improving your system. 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. It can also cause problems with the synchronization in the playback of music in sequence-editors.

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.

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

This soundfont comes in the “fluid-soundfont-gm” package, and comes with Qsynth. On SUSe Linux, it was not available, and I had to get it over the Internet (do a Google-search for “soundfonts free”).

This is, in my opinion, one of the best soundfonts available. 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 is made by appending the following line to the “/etc/modprobe.d/alsa-base.conf” file:

options snd-emu10k1 max_buffer_size=150

You have to reboot before this change takes-effect. If you don't make this change, some instrument voices (notably, the oboe) will not make any sound when using the FluidR3_GM.sf2 soundfont.

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.

As with any soundfont, you should explore all of the instrument-sounds it provides, to discover which sounds you like best. I particularly like the piano, oboe, steel-string guitar, cello, choir aahs, 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” 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.

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.

NOTE: Both of these two soundfonts have a quirk where if you use the Modulation MIDI control (to increase vibrato), the sound is perhaps interesting for guitar-type instruments, but not good for instruments such as flute, oboe, or cello. That is my opinion. You can try it and see for yourself.

Reducing 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. On the plus-side for it, it actually sounds a little better than hardware synthesizers in a sound-card.

NOTE: There is a problem (bug) with the “1.1.5” version of libfluidsynth1 (which unfortunately, is what comes with Ubuntu levels11.10 through 12.10 – including in the LTS release). The problem has been fixed in the “1.1.6” version.

The symptom of this bug is that in playing a fairly elaborate sequence file, it will get into a state where voices noticeably don't play, or play for only a short time, then abruptly stop playing. Once in this state, it keeps doing it – even on new pieces. The only way to get out of this state, is to terminate Qsynth/Fluidsynth, and re-start it.

This symptom is more likely to occur if you reduce the polyphony parameter of Qsynth to 64 (rather than the default 256), which is needed on slower machines to reduce processor overhead. It can happen on the Rosegarden demo-piece “Stormy Riders”.

Qsynth does require a somewhat fast machine. On my test machines, it works fine on a 900 megahertz speed machine, and I have used it successfully on a 450 megahertz machine whose CPU includes a Floating-Point Unit (FPU). I do use JACK (rather than PulseAudio) on my machines, however, since it runs more efficiently that way.

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

NOTE: When using Qsynth with slower machines, you will have to create a limits-file for your user-ID, allowing you real-time priority, and memory-lock privileges.

For example, my user-ID is “aere”, so I create a file called “aere.conf”, in the “/etc/security/limits.d” directory. That file contains the following lines:

aere - rtprio 85

aere - memlock unlimited

Notice that the first parameter on each line is your user-ID (“aere” in my case). The first parameter starts in column 1.

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. I got around that by obtaining FluidR3_GM.sf2 from the Internet, and running Fluidsynth from a terminal-window. Rosegarden can connect to instances of Fluidsynth running in a terminal-window. JACK (the qjackctl package) was also available.

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 probably work without it if you have a fairly fast computer, using PulseAudio, ALSA, or whatever sound system your Linux system uses. On the various 'flavors' of Ubuntu Linux, the PulseAudio Sound Server is used. So we will start out by configuring Qsynth to use PulseAudio, rather than JACK.

It is reasonable to first try this approach, since there are cases where JACK will not co-exist with other system components. Also, 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.

Since Rosegarden depends on JACK for audio-files, you will need to go on to the next step, showing you how to configure it with JACK, but the following steps show you how to configure it with just PulseAudio.

Once installed (as you did earlier), you find Qsynth in the “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 my machine (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. But don't do it unless you have to, because this does contribute to a better sound.

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.


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 a bit more predictable where you choose a device in Rosegarden.

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. 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 Rosegarden, and you should see Qsynth as one of the MIDI playback devices (accessed via the “Manage MIDI Devices” toolbar button).

Adding An Additional Qsynth Engine

It's often a good idea to configure an 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