[LAT] A guide to optimize JACK?

Robin Gareus robin at gareus.org
Sat Aug 9 12:18:18 EDT 2008

Hash: SHA1

trece ocho wrote:
> Hi there!,

> I want to optimize JACK capabilities in running Linux PCs.
Welcome Trece ;)

> What JACK configuration parameters do I have to vary (and in what way) to
> achieve that?
> (by "that" I mean: minimum latency, zero noise and zero xruns).

read `man jackd`  - you want to set "-p <num> -n <num>"

 -n: usually 2 or 3 - mostly depends on your sound-card
 -p: 32,64,128,... 4096  "the period" defines buffer-size and latency

There's no "best" latency settings.

For recording you probably want to use a small period size for low
latency monitoring. But when you master, mix or edit: raise it up to
>=1024 (many postprocessing effects are very CPU intense, and you do not
need low latency to listen).  Most versions of JACK allow the period to
be changed during runtime: `man jack_bufsize`

Latency and Xruns are related: The higher the latency the less chance of
xruns.  To get a 'zero-xrun' system you want to run jackd with
/realtime-priority/ on a realtime-patched linux kernel and lock the it's
pages into memory (no swap):

 1. get or compile a realtime kernel
 2. set up IRQs
 3. permit audio users to use realtime capabilities
 4. start jackd as user with realtime capabilities

For (1) I suggest to get a binary for your gnu/Linux distribution.
  64studio, musix, ubuntu-studio, gentoo-pro-audio-overlay, CCRMA..

(2) 64studio offers a debian package rtirq for a great script from Rui:
  There's probably other packages as well.

(3) that's the /etc/security/limits.conf part

(4) /usr/bin/jackd -R -P 70 -T -d alsa -n 3 -r 48000 -p 128 -d hw:1,0
   or use the "Realtime" checkbox in qjackctl's Setup dialog.

zero noise: N/A -  check your cables ;)

> I'm looking for something like a "standard procedure"...
use qjackctl.

>...but sometimes the audio crackles, has xruns, can't get it to work
> even with high latency, etc... and I don't have a clue about what to
> vary to fix that.

aah, although this sound can be described as /noisy/, x-runs are no
*noise* ;) and are not only correlated to latency.

They're normal:  Unix is //fair// to all users and sometimes does not
see a reason why it should keep playing your sound or even keep it in
memory UNLESS you tell it to do so. (steps 1-4 above)
There's a lot of background-jobs on a default gnu/Linux; fi. `updatedb`
may get in your way..

> I'm working.. 
That sounds interesting. - I think you should post that to the
Linux-Audio-Users mailing list (or if you have questions about
program-code to  linux-audio-dev). Here it is a little off-topic and you
may get more feedback there.

Version: GnuPG v1.4.9 (GNU/Linux)


More information about the Linux-audio-tuning mailing list