Improving Your Chromebook 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 is one of the normal dependencies of the KeyMusician Keyboard, and 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).

You can use it at-will on Chromebook, including in the Java Sound synthesizer. You can also use it with Qsynth, or Fluidsynth. With limited RAM, you may have difficulties using it with the Java Sound synthesizer.

When you start up the KeyMusician Keyboard, it asks if you want to use a different set of instrument sounds. If you answer “Yes”, it loads this soundfont.

If you choose this, but after initializing, you end up with a very long (over 5 seconds) latency, click on the “F1 (Help/Setup) pane, then click on the “MIDI Output To” drop-box, setting it to “(none)”. Then click on it again, and select the Gervill Software MIDI Synthesizer”. After doing this, you can select the better soundfont at this point, with no problems.

If this happens to you (especially if it happens often), answer “No” when it asks you about it during initialization. Then, after it initializes with the default soundfont, select the “F1 (Help/Setup)” pane, and click the “Load Soundfont” button. Loading the FluidR3_GM soundfont at this point should work fine.

A way to avoid this hassle, and also get reduced latency, is to use Qsynth, rather than the Java Sound (Gervill) synthesizer, which is explained later in this web-page.

I recommend you 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:

Picture of the KMK F1 pane, with "FluidR3_GM.kmk" selected in the Configuration File drop-dox.
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 some other 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

Latency is the delay between hitting a key, and hearing the sound of its note. Latency makes it difficult to play fast-tempo music, or quick phrases.

You can reduce latency by using external synthesizers connected to your computer via a USB MIDI interface.

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, and reduces latency to imperceptible levels.

Of the software synthesizers available on Linux, Qsynth (Fluidsynth) is your best choice. It has significantly less latency than the Java Sound synthesizer you have been using up to this point.

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 also have to 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 have limited RAM, you may have to use the smaller TimGM6mb.sf2 soundfont. With limited RAM, in order to have more than one Qsynth engine (or a second copy of Fluidsynth running), at least one of them may have to use the small (TimGM6mb.sf2) soundfont.

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, if you have a fairly fast CPU speed, it will work without it, using PulseAudio. 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, and see if it works.

If you get a lot of audio drop-outs, try making the changes in the indented paragraphs below:

In the “/etc/security/limits.d/” directory, specific limits are set for specific users. Each file in that directory corresponds to a user-ID, and it specifies the limits for that user.

For example, my user-ID is “aere”, and in the “/etc/security/limits.d/” directory on my system, there is a file named “aere.conf”, which specifies specific limits (or extra capabilities) for me (user “aere”).

The contents of that file on my system, are as follows:

aere - rtprio 85

aere - memlock unlimited

Note that each line starts with my user-ID (“aere”).

You need to create a similar file (for your user-ID) in that directory.

You can do that by running your system's terminal program, and cut-and-pasting the line highlighted below into it, and transmitting that line. If you don't know how to use the “vi” editor, substitute the name of the editor you use (such as “mousepad” or “gedit”) in place of “vi” in the line below. Also, substitute your user-id in place of “userid”.

sudo vi /etc/security/limits.d/userid.conf

After transmitting the above line, you'll have to enter your sign-in password (and the cursor won't advance while you do it).

After successfully entering your password, an empty file will be displayed in the editor. Enter the following two lines, substituting your user-ID in place of “userid” in the two lines you enter:

userid - rtprio 85

userid - memlock unlimited

After doing-so, save the file. You have to log-off and sign back in before the change takes effect.

If after doing the above, you still get audio drop-outs, you'll have to use JACK (qjackctl) to avoid them. In my testing on Chromebook, I was only able to get JACK to work on a Linux system installed within ChromeOS (the “crouton” option).

With a fast machine, it is reasonable to first try using PulseAudio, since this way, you only need to fire-up Qsynth (instead of both Qjackctl and Qsynth).

We tell you later in this web-page how to change Qsynth to use JACK (Qjackctl), and how to set up Qjackctl.

Once installed (it comes with the 'normal' dependencies of KMK), you find Qsynth among the other Linux applications, or in the “MultiMedia” area of the application menu on a full Linux system (such as the 'crouton' option). 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:

Screen-shot of the Qsynth window, with the cursor pointing at its Setup button.
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 slow machine, by disabling the “Reverb” controls in a similar manner. This could help you in eliminating audio drop-outs.

To configure Qsynth for the selected tab at the bottom of the Qsynth window above, (Qsynth1, in my case), click on the “Setup” button (on your machine), as pointed-to by the cursor in the screen-shot 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.

Screen-shot of the Qsynth Setup window, with the MIDI tab selected, and Qsynth1 selected in the MIDI Client Name drop-box.
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):

Picture of the Qsynth Setup window, with its Audio tab selected.  The Polyphony setting is 64, and Jack is currently showing as the audio driver.
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 from the beginning to avoid audio drop-outs.

Keep in mind that it may be difficult or impossible to get JACK to work in many Chromebook Linux environments.

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 audio 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:

Screen-shot of the Qsynth Setup window, with its Soundfonts tab selected.  The cursor is pointing at the Open button, and the FluidR3_GM soundfont is available for selection in the main pane.
On your machine, the first time you configure it, there will be no soundfont 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. Unless your computer has limited RAM (memory), select the “FluidR3_GM.sf2” entry. Otherwise, you could 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:

Screen-shot of the KMK F1 pane, with Qsynth1 selected in the MIDI Output To drop-box.
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:

Screen-shot of the Qsynth window, with the cursor pointed at the Add New Engine button at the lower left of the window.
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 (or 3, or 4), as appears above.

Click on the Qsynth 'engine' tab you want to configure (highlighting it), then 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 on Chromebook, 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)