Configuring The Jack Audio-Connection Kit, And Changing Qsynth To Use It
As a cautionary note, you need to be aware that in using JACK (and in configuring your system to use it, or stop using it), there are cases where your system could hang. If this happens, your only choice will probably be to power-down your computer. Where Linux uses a journaling file system, it shouldn't harm your file system.
You find the graphical-user-interface for controlling the Jack Audio-Connection Kit (QjackCtl) in the application menu, under “Sound & Video”, or “Multi-Media”. On Ubuntu-Studio, it's under the “Audio Production” entry in the application menu. Click on it to activate it. You may want to create a launcher icon for it on your desktop, or the panel, but you can always get to it from the launcher menu.
When you launch it, a small window appears for it, but it will not start operating until you configure it. Its window looks like the following:
Click on the “Setup” button to configure it (as shown above). A dialog-box will appear that looks like the screen-shot below:
Click the “Interface” drop-box, as shown in the above screen-shot. When you do so, a pop-up menu will appear, as shown in the screen-shot below:
In my case (above) I am using the M-Audio M-Track USB audio interface. I also have another sound-card, the HDA Intel PCH internal sound card. I could have selected it by clicking on the 1st entry (the “hw:0” entry). If you select (click on) “(default)”, it will always use the first entry in the list.
On Chromebooks, where you are installing in a virtual box within ChromeOS, or are installing into a complete Linux system installed within ChromeOS (called “crouton”), you need to place the cursor within the “Interface” combo-box, delete the text already there, and type-in cras – that choice (which you need) will not appear in the menu.
Be aware that if you plug in new USB devices to your computer (or un-plug devices you used to use), the order of devices in this list may change, so you may (at that time) need to re-configure the device JACK is supposed to use.
Newer versions of JACK show a graphical picture of the connections, which is pretty, but much harder to use. You can change the “Graph” button back to the “Connections” button, by un-selecting the “Replace Connections with Graph button” option, as shown in the screen-shot below:
The option (where the cursor is) to clear, restoring the use of the “Connections” button
You may want to configure JACK so that it starts working automatically when you fire it up from the menu, rather than waiting for you to click its “Start” button (as you will have to do the first time you use it).
To configure it to start running automatically, click on the “Misc” tab of the Setup dialog, and click-on (so a check-mark appears) the “Start JACK audio server on application startup” check-box, as shown in the screen-shot below:
When you're done, click on the “OK” button (which will be enabled when you change something). If you didn't change anything, simply click the “Cancel” button.
QjackCtl is now configured, and ready to start running. You start it running by clicking the “Start” button, as shown in the screen-shot below:
If there are errors, you need to address the cause of the error, and fix it. The most common cause of errors, is having a device configured as the sound-card that actually isn't the sound-card (such as a USB MIDI interface, or a USB MIDI keyboard). If that happens, simply configure the right device (which must actually be a sound-card). You'll have to answer any error dialog-boxs that appear, before you can change the configuration.
For more information on JACK, refer to the JACK Audio Connection Kit web-site at the following link:
JACK Audio Connection Kit Web-Site
To change the configuration to fix errors, click the “Setup” button. After you change it, you'll have to click the “Start” button again.
Assuming it starts running successfully, you are ready to re-configure Qsynth to use JACK.
Changing Qsynth To Use JACK Instead Of PulseAudio
To use Qsynth with JACK, you first need to make these changes. If QjackCtl is already running, you need to terminate it by clicking on its “Quit” button. If you don't do this, you could cause your system to hang.
After making sure QjackCtl isn't running, launch Qsynth. Assuming you have added a 2nd engine to it (for use by the integrated MIDI player), you will have to repeat the steps below for that engine as well. Clicking the “Setup” button affects only the currently-highlighted engine-tab's engine.
Click the “Setup” button of the Qsynth window, to change the configuration of the currently-highlighted engine. A dialog-box will appear similar to the following:
Click on the “Audio Driver” drop-box, and select its “jack” entry, as shown in the screen-shot above. Then click the “OK” button.
It will ask you if you want to restart the sound server. Tell it NOT to restart the sound server. If you restart it now, you could hang your system.
Having done that, click on your other engine's tab (highlighting it), and click Qsynth's “Setup” button. Set its “Audio Driver” drop-box to “jack”, as you did with the other engine, and click the “OK” button.
Again, it will ask you if you want to restart the sound server. Tell it not to restart the sound server. If you restart it now, you could hang your system.
Now, click the “Quit” button of Qsynth's window, causing it to exit, with the configuration safely changed.
At this point, you should be able to launch QjackCtl, and when it finishes initializing, launch Qsynth, which should now be using JACK, and therefore will be running much more efficiently.
With Qsynth now depending on JACK, it is important to first bring up (or make sure it's already running) QjackCtl, before bringing up Qsynth. YOU HAVE TO REMEMBER TO DO THIS EVERY TIME YOU USE QSYNTH.
Also, you need to be aware that you can't use the Java Sound (Gervill) synthesizer when JACK (QjackCtl) is running. But where Qsynth is a better synthesizer, you shouldn't need to do this.
At this point, you are done. You can use your browser's “back” button to return to other sections you were reading.
If You Still Get Audio Drop-Outs, Or Are Using Linux On ChromeOS
If you're still getting audio drop-outs after having made the foregoing changes, there is yet another change you can make to prevent them.
This change works on Ubuntu variants, and I don't know if it is applicable to other Linux distributions.
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 (or possibly even reboot) before the change takes effect.
With the above change in my system, I can successfully run Qsynth on a very slow (450 megahertz) machine.
So do take the time to try this configuration change. It can make a big difference.