JACK

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).

Installation[edit | edit source]

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. JACK is the original implementation, it uses a C API and has built-in Linux MIDI integration. Whereas JACK2 is a re-implementation in C++ and has support for SMP and DBUS.

Visit "what are the differences between JACK 1 and JACK2" for an in-depth comparison.

JACK[edit | edit source]

root #emerge --ask media-sound/jack-audio-connection-kit

USE flags for media-sound/jack-audio-connection-kit A low-latency audio server

alsa Add support for media-libs/alsa-lib (Advanced Linux Sound Architecture)
altivec Add support for optimizations for G4 and G5/ppc970 processors
coreaudio Build the CoreAudio driver on Mac OS X systems
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
examples Install examples, usually source code
oss Add support for OSS (Open Sound System)
pam Add basic realtime configuration via sys-auth/realtime-base

JACK2[edit | edit source]

First, emerge the sound server itself.

root #emerge --ask media-sound/jack2

USE flags for media-sound/jack2 Jackdmp jack implemention for multi-processor machine

alsa Add support for media-libs/alsa-lib (Advanced Linux Sound Architecture)
classic Enable building of jackd
dbus Enable dbus support for anything that needs it (gpsd, gnomemeeting, etc)
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
ieee1394 Enable FireWire/iLink IEEE1394 support (dv, camera, ...)
libsamplerate Build with support for converting sample rates using libsamplerate
metadata Enable metadata API
opus Enable Opus audio codec support
pam Add basic realtime configuration via sys-auth/realtime-base
readline Enable support for libreadline, a GNU line-editing library that almost everyone wants
sndfile Add support for libsndfile

USE flag[edit | edit source]

The global USE flag jack enables support for JACK in other packages, so they can submit sound to a JACK server:

root #euse -E jack

The euse command is part of app-portage/gentoolkit.

After setting this be sure to update the system so the changes take effect:

root #emerge --ask --changed-use --deep @world

Configuration[edit | edit source]

Sound Server[edit | edit source]

JACK can be configured using the jack_control utility. A basic configuration script for JACK could look like:

CODE A basic configuration
jack_control start
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 playback device you want to use instead of hw:2,0, you can use:

user $aplay -l

GUI[edit | edit source]

A good JACK configuration and control software is media-sound/cadence.

root #emerge --ask media-sound/cadence

Bridging[edit | edit source]

JACK can route sound which was sent to other sound systems like PulseAudio and ALSA through itself.

PulseAudio[edit | edit source]

To use PulseAudio's JACK module media-sound/pulseaudio needs to have the jack USE flag enabled.

In order to route all audio from PulseAudio to JACK, the JACK sink needs to be configured:

user $pactl load-module module-jack-sink channels=2
user $pactl load-module module-jack-source
user $pacmd set-default-sink jack_out

PulseAudio will recognize that JACK started and will bridge its audio to JACK.

This article is issued from Gentoo. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.