Friday, August 25, 2017

JACK Audio/ALSA on Ubuntu


Most Linux distributions (except audio-oriented distros such as Ubuntu Studio) have active memory limits too restrictive to operate JACK.

First, try ulimit -l. If the output is not 'unlimited' you will need to make it so by changing some configurations.

1. Your login user must be part of the groups 'audio' and 'realtime'. Typically:

groupadd realtime
usermod -a -G audio <my user>
usermod -a -G realtime <my user>

2. Increase memory limits and I/O priority for the audio group. Edit /etc/security/limits.d/audio.conf and make sure it contains:

@audio   -  rtprio     95
@audio   -  memlock    unlimited

3. Give the JACK daemon high priority:

dpkg-reconfigure -p high jackd

4. Enable PAM limits. Edit /etc/pam.d/common-session and add:

session required pam_limits.so

5. Log out and log back in to activate the changes

6. Start JACK. Make sure your output device is correctly referenced by hw:<n>.

jackd -R -d alsa -d hw:1 -r 44100

To list local devices:

aplay -l

Verify configuration in your software of choice, e.g. Ardour, LMMS, Audacity.