From Fedora Project Wiki

Revision as of 17:10, 20 November 2012 by Bsjones (talk | contribs)

Install and Configure JACK

This has been copied from 2.3 of the Fedora Musicians guide

  1. Use PackageKit or Apper to install the jack-audio-connection-kit and qjackctl packages.
  2. Review and approve the installation, making sure that it completes correctly.
  3. Run QjackCtl from the KMenu or the Applications menu.
  4. To start the JACK server click Start. To stop the JACK server click Stop.
  5. Click Messages to see messages, which are usually errors or warnings.
  6. Click Status to see various statistics about the currently-running server.
  7. Click Connections button to see and adjust the connections between applications and audio hardware.
JACK operates with special real-time privileges. You must add all JACK users to the jackuser group. Learn how to add users to groups in Chapter 22, Users and Groups of the Fedora Deployment Guide, available at http://docs.fedoraproject.org. Do not add a user to the jackuser group if they will not use JACK.

By default, QjackCtl configures JACK to use the 'default' sound card. The 'default' sound card uses all features of the ALSA driver even though JACK provides the same features. To save memory and processor time, you should configure QjackCtl with a specific sound card.

  1. Open a terminal. In GNOME, choose Applications → System → Terminal. In KDE, click on the application launcher, then choose System → Konsole.
  2. Execute this command: cat /proc/asound/cards
  3. The cat program outputs a list of sound cards in your computer that looks similarly to the output below.

        0 [SB             ]: HDA-Intel - HDA ATI SB
                          HDA ATI SB at 0xf7ff4000 irq 16
        1 [MobilePre      ]: USB-Audio - MobilePre
                          M Audio MobilePre at usb-0000:00:13.0-2
    

    In this example output, the square brackets surround the name of the sound card. The names of the sound cards in this example output are SB and MobilePre.Identify the name of the sound card that you want to use. If you do not see your sound card in the list outputted by cat, then your computer does not detect it.

  4. Start QjackCtl.
  5. Click Setup to open the "Setup" window.
  6. In the 'Interface' text box, type the name of your preferred sound card with "hw:" in front. With the sound cards listed above, you might write hw:MobilePre.
  7. Save your settings by exiting QjackCtl. If you want to use JACK, restart QjackCtl.

Using the Jack D-Bus Interface

Control applications such as qjackctl can be configured to interact with the jack sound server using D-Bus. This has the advantage of allowing jack to request the release of the sound device from Pulseaudio (see below).

jackdbus is shipped in a separate package. To install this (as root) do:

    yum install jack-audio-connection-kit-dus

Finally, check "Enable D-Bus interface" in Setup -> Misc within Qjackctl


Integrate Jack with Pulseaudio

Jack will ask Pulse Audio through D-Bus for ownership of the sound card. Pulse Audio will grant it and Jack will have complete control of it. No conflicts and no configuration necessary. In this case Pulse Audio will stop using the card and if it is the only one, you will not have sound for system sounds, browser media playback, etc (which is usually what you want). Otherwise it is possible to load a Pulse Audio module that redirects PA to use Jack.

Running Jack in Realtime mode

NOTE: This is obsolete and kept for informational purposes. The changes suggested below are done automatically by Jack installation (/etc/security/limits.d/95-jack.conf) and no manual modification of the pam configuration should be necessary.

The JACK server jackd has the capability to run in a real-time mode which greatly decreases the chance of audio glitches. The real-time mode is enabled by passing the -R or --realtime option to jackd when starting the server. It is only possible to run jackd in real-time mode as a non-root user by modifying your PAM configuration, PAM stands for Pluggable Authentication Modules and is the primary authentification mechanism used on Fedora. The primary source of PAM documentation can be found at the following at http://www.kernel.org/pub/linux/libs/pam/

The specific PAM configuration file that needs to be modified is /etc/security/limits.conf and it controls the system resource limits. It is important to understand that modifying the resource limits configuration files can decrease the security of your system. Documentation specific to the resource limits PAM module can be found at http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam-6.html#ss6.12

Alternatively, one can create a new file

  /etc/security/limits.d/<priority>-<name>.conf

that contains the resource limits for individual users and/or groups. The jack-audio-connection-kit package that comes with Fedora contains the file

  /etc/security/limits.d/99-jack.conf

that does this job for you.

The resource limits that need to be changed to allow jackd to run in realtime mode are named rtprio and memlock. To increase the limits for a specific user named fred you would add the following to /etc/security/limits.conf

fred - rtprio 70 fred - memlock 50000

The value of rtprio can be set in the range 0 - 99 where any value greater that 0 will allow the user to change the scheduling policy to "real-time". By default the JACK server requires a minimum rtprio setting of 20 but jackd will accept a command line parameter -P or --realtime-priority which will change the minimum required value of rtprio that is needed, but the default of 20 is nearly always sufficient.

The appropriate value for memlock is dependent on the amount of memory present in the system but a minimum value of 50000(50MB) and a maximum value of half the available memory can be used as a rough guideline.

To verify that the resource limits have been modified you can use the bash built-in ulimit command, for example:

$ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
max nice                        (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 8191
max locked memory       (kbytes, -l) 50000
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
max rt priority                 (-r) 70
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 8191
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
file locks                      (-x) unlimited

Keep in mind that you may have to re-login before changes to limits.conf, or additions to the limits.d/ directory to take effect.

rtirq

rtirq is a startup script which allows you to tune the realtime priority of software IRQ threads handling audio devices.

    yum install rtirq

For rtirq to function you will need to append the threadirqs parameter to the kernel command line. The default realtime priorities chosen in the rtirq package are those that work best with Jack defaults. You can tailor rtirq to your specific hardware needs by editing /etc/sysconfig/rtirq

(example required)