6eabaff
	USING ALSA DIRECTLY
6eabaff
6eabaff
Switch to root account.
6eabaff
6eabaff
Install the required packages:
8fb166d
    dnf install alsa-plugins-jack
6eabaff
7c93f39
Add yourself to the jackuser group.
b81b6f4
    usermod -a -G audio,jackuser "<your username>"
a64fdde
Now you will need to log out and log back in, or simply restart the system.
6eabaff
1a544e7
Start the jack daemon (the best parameters for your sound card may be different):
1a544e7
    jackd -R -d alsa -d hw:0
1a544e7
This will start jack on the first sound card, at 48KHz sampling rate (can be 
1a544e7
changed with the "-r" command line parameter), with a period of 1024 frames 
1a544e7
(change with "-p", determines the latency) and with 2 interrupts per period 
1a544e7
(change with -n). USB sound cards can benefit from running with "-n 3" or
1a544e7
"-n 4". All of these optional parameters should be specified after "-d alsa".
84586ae
1a544e7
It is best to replace the card number with the card name as the numbering can
1a544e7
change from boot to boot if there is more than one sound card. The name of a
1a544e7
particular card can be found in the output of "cat /proc/asound/cards", for each
1a544e7
card it is the string between square brackets without the trailing blanks.
84586ae
1a544e7
Note: Jack is a sound server and not a daemon - while it does work "in the 
1a544e7
background" it is not something similar to unix daemons which are started at
1a544e7
boot time.
84586ae
84586ae
1a544e7
	QJACKCTL
84586ae
1a544e7
This application can be used to control the jack sound server with a graphical
1a544e7
interface. It can be started via
1a544e7
    qjackctl -s
1a544e7
"-s" parameter makes the jack sound server start immediately.
84586ae
1a544e7
When starting jack through qjackctl it is important to note that you should (at
1a544e7
least) change the "Interface" field in the "Setup" dialog to _not_ be "(default)"
1a544e7
which would point Jack to use Pulse Audio. The proper "Interface" is the direct
1a544e7
hw ALSA device (hw:0 for the first card, etc). Even best to use the name of the
1a544e7
card as stated above.
84586ae
84586ae
7c93f39
    USING THE JACK DBUS INTERFACE
7c93f39
7c93f39
Control applications such as qjackctl can be configured to interact with the jack
7c93f39
sound server using D-Bus. This has the advantage of allowing jack to request the
7c93f39
release of the sound device from Pulseaudio (see below).
7c93f39
7c93f39
jackdbus is shipped in a separate package. To install this (as root) do:
7c93f39
8fb166d
    dnf install jack-audio-connection-kit-dbus
7c93f39
7c93f39
and check "Enable D-Bus interface" in Setup -> Misc within Qjackctl
7c93f39
7c93f39
1a544e7
	INTEGRATE JACK WITH PULSEAUDIO
84586ae
7c93f39
Jack will ask Pulse Audio through D-Bus for ownership of the sound card. Pulse
1a544e7
Audio will grant it and Jack will have complete control of it. No conflicts and
1a544e7
no configuration necessary. In this case Pulse Audio will stop using the card
1a544e7
and if it is the only one, you will not have sound for system sounds, browser
1a544e7
media playback, etc (which is usually what you want). Otherwise it is possible
1a544e7
to load a Pulse Audio module that redirects PA to use Jack.
84586ae
84586ae
7c93f39
7c93f39
84586ae
	RUNNING JACK SERVER IN REALTIME MODE
9612371
6eabaff
NOTE: This chapter explains why you have done the above changes in more detail.
1a544e7
It is kept for informational purposes. The changes suggested below is done
1a544e7
automatically by your Jack installation and no manual modification of the
1a544e7
pam configuration should be necessary.
1a544e7
4bee82a
9612371
The JACK server jackd has the capability to run in a real-time mode
9612371
which greatly decreases the chance of audio glitches. The real-time mode
9612371
is enabled by passing the -R or --realtime option to jackd when starting
9612371
the server. It is only possible to run jackd in real-time mode as a
9612371
non-root user by modifying your PAM configuration, PAM stands for
9612371
Pluggable Authentication Modules and is the primary authentification
9612371
mechanism used on Fedora. The primary source of PAM documentation can be
9612371
found at the following at http://www.kernel.org/pub/linux/libs/pam/
9612371
9612371
The specific PAM configuration file that needs to be modified is
9612371
/etc/security/limits.conf and it controls the system resource limits. It
9612371
is important to understand that modifying the resource limits
9612371
configuration files can decrease the security of your system.
9612371
Documentation specific to the resource limits PAM module can be found at
9612371
http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam-6.html#ss6.12
9612371
6eabaff
Alternatively, one can create a new file 
6eabaff
   /etc/security/limits.d/<priority>-<name>.conf
6eabaff
that contains the resource limits for individual users and/or groups. The
6eabaff
jack-audio-connection-kit package that comes with Fedora contains the file
6eabaff
   /etc/security/limits.d/99-jack.conf
6eabaff
that does this job for you.
6eabaff
9612371
The resource limits that need to be changed to allow jackd to run in
9612371
realtime mode are named rtprio and memlock. To increase the limits for a
9612371
specific user named fred you would add the following to
9612371
/etc/security/limits.conf
9612371
9612371
fred - rtprio 20
9612371
fred - memlock 50000
9612371
9612371
The value of rtprio can be set in the range 0 - 99 where any value
9612371
greater that 0 will allow the user to change the scheduling policy to
9612371
"real-time". By default the JACK server requires a minimum rtprio
9612371
setting of 20 but jackd will accept a command line parameter -P or
9612371
--realtime-priority which will change the minimum required value of
9612371
rtprio that is needed, but the default of 20 is nearly always
9612371
sufficient.
9612371
9612371
The appropriate value for memlock is dependent on the amount of memory
9612371
present in the system but a minimum value of 50000(50MB) and a maximum
9612371
value of half the available memory can be used as a rough guideline. 
9612371
9612371
To verify that the resource limits have been modified you can use the
9612371
bash built-in ulimit command, for example:
9612371
9612371
$ulimit -a
9612371
core file size          (blocks, -c) 0
9612371
data seg size           (kbytes, -d) unlimited
9612371
max nice                        (-e) 0
9612371
file size               (blocks, -f) unlimited
9612371
pending signals                 (-i) 8191
9612371
max locked memory       (kbytes, -l) 50000
9612371
max memory size         (kbytes, -m) unlimited
9612371
open files                      (-n) 1024
9612371
pipe size            (512 bytes, -p) 8
9612371
POSIX message queues     (bytes, -q) 819200
9612371
max rt priority                 (-r) 20
9612371
stack size              (kbytes, -s) 10240
9612371
cpu time               (seconds, -t) unlimited
9612371
max user processes              (-u) 8191
9612371
virtual memory          (kbytes, -v) unlimited
9612371
file locks                      (-x) unlimited
9612371
file locks                      (-x) unlimited
9612371
6eabaff
Keep in mind that you may have to re-login before changes to limits.conf,
6eabaff
or additions to the limits.d/ directory to take effect.
9612371