This article describes the setup of a playing sound with JACK (JACK Audio Connection Kit).
JACK is a sound server for professional audio production, that provides low-latency communication for applications that implement the JACK API (like mpv).
JACK is designed to work with only one active audio interface (sound card), because of technical reasons needed to guarantee audio quality, latency, and synchronization. Remember, JACK is designed for studio quality work, not for ease of use. If more, or different, inputs and outputs are needed, use a different audio interface. It may be possible to get multiple interfaces working at the same time with JACK, but it is not trivial, and results may vary.
When the JACK daemon is running, usual system sound may no longer be output. To restore sound there are several options, such as configuring applications to output to JACK, using a second soundcard, or bridging.
JACK uses ALSA for accessing the sound card hardware, be sure ALSA is working.
There are two implementations of the JACK API, both implementations are considered equivalent. JACK2 is usually the one to go for, JACK 1 is no longer under active development.
JACK is the original implementation, it uses a C API and has built-in Linux MIDI integration. JACK2 is a re-implementation in C++ that has support for multiprocessing and D-Bus, while MIDI support is handled by ALSA. Visit what are the differences between JACK 1 and JACK2 for an in-depth comparison.
USE flags for media-sound/jack2 Jackdmp jack implemention for multi-processor machine
|Add support for media-libs/alsa-lib (Advanced Linux Sound Architecture)
|Enable building of jackd
|Enable dbus support for anything that needs it (gpsd, gnomemeeting, etc)
|Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
|Enable FireWire/iLink IEEE1394 support (dv, camera, ...)
|Build with support for converting sample rates using libsamplerate
|Enable metadata API
|Enable Opus audio codec support
|Add basic realtime configuration via sys-auth/realtime-base
|Enable use of systemd-specific libraries and features like socket activation or session tracking
|Pull basic tools (e.g. jack_lsp/connect) from media-sound/jack-example-tools
Emerge the sound server:
emerge --ask media-sound/jack2
JACK2 will successfully compile with LTO enabled, but incoming connections will suffer a segmentation fault, fail to see ports, or fail to connect to open ports. Be sure to compile without LTO for a functional experience.
The JACK 1 package is(link provides a list of JACK 1 USE flags).
Global JACK USE flag
jack USE flag enables support for JACK in other packages, so they can submit sound to a JACK server:
euse -E jack
The euse command is part of .
After setting this, be sure to update the system so the changes take effect:
emerge --ask --changed-use --deep @world
There is a JACK configuration and control software package:
emerge --ask media-sound/cadence
Another alternative is:
emerge --ask media-sound/qjackctl
See the article on music production for software to use with JACK.
The JACK website has a page on sofware that uses JACK.
All users that need JACK should be in the audio group:
usermod -a -G audio $USERNAME
JACK can be configured using the jack_control utility. A basic configuration script for JACK could look like:
jack_control ds alsa
jack_control dps device hw:2,0
jack_control dps rate 48000
jack_control dps nperiods 2
jack_control dps period 64
To determine the appropriate playback device (instead of hw:2,0):
To use PulseAudio's JACK module
jack USE flag enabled.
In order to route all audio from PulseAudio to JACK, the JACK sink needs to be configured:
pactl load-module module-jack-sink channels=2
pactl load-module module-jack-source
pacmd set-default-sink jack_out
PulseAudio will recognize that JACK started and will bridge its audio to JACK.
"Cannot use real-time scheduling" error
Some applications may show a permission error when trying to connect to Jack, for example:
ERROR: JACK: Cannot create thread res = 1
ERROR: JACK: JackClient::AcquireSelfRealTime error
ERROR: JACK: Cannot use real-time scheduling (RR/5) (1: Operation not permitted)
Adding the current user to the realtime group should solve this:
usermod -a -G realtime $USERNAME
Log out and log back in to apply group change.
- ALSA — describes the setup of a sound card with ALSA (Advanced Linux Sound Architecture).
- PipeWire — low-latency, graph-based, processing engine and server, for interfacing with audio and video devices.
- PulseAudio — a multi-platform, open source, sound server that provides a number of features on top of the low-level audio interface ALSA