back

Jack user howto

Jack (also known as Jack Audio connection kit) is a Linux program that allows to send audio data between programs and devices in realtime. It allows to connect output from one program to many others (eg. recording program, frequency visualizer and sound card) all at the same time with minimal effort. You may think about it as a box with many inputs and outputs (created by client programs) that allows you to connect them as you see fit. More about jack can be found at its home page http://jackaudio.org/.

This howto describes how to use jackd from user perspective (as opposed to programmer perspective).

Starting jack

To start jack type in command line

jackd -d alsa

It will start jackd (jack server daemon) with default parameters using alsa as its backend to play sound through your sound card. Details about options can be found in jackd man page.

After starting jack with alsa driver no other program will be able to use alsa. Also if other program is using alsa (eg. for playing music) jack will refuse to start giving message:

ATTENTION: The playback device "hw:0" is already in use. Please stop the application using it and run JACK again
cannot load driver module alsa

If you wish to use jack only for sending audio data between programs and not playing it out loud, you can use dummy driver:

jackd -d dummy

To stop jack simply kill it (eg. by using Control-C).

You may also use qjackctl to start jack using gui.

Making connections between programs

Every program that uses jack can make input and output ports that can be used to receive and send audio data.

Some programs make connections between ports automatically eg. audio player can connect to system output ports at startup (which are used to play sounds on speakers). You can also manage connections manually using programs.

Jack command line tools

Jack comes with a few command line tools including:

jack_lsp
Lists jack ports, their properties and connections.
jack_connect
Allows to connect two jack ports.
jack_disconnect
Disconnects two jack ports.

Using jack_lsp

I have started few programs using jack to make listings more reasonable.

To list available ports:

[noniwoo@noniwoo-lap articles]$ jack_lsp
system:capture_1
system:capture_2
system:playback_1
system:playback_2
alsaplayer-1737:out_1
alsaplayer-1737:out_2
metro:120_bpm
simple:input
simple:output
dftvisualize:input

Every port full name has two parts: client (program) name and port name separated by ':'.

Client names within jack must be unique. Every port name within single client must be unique.

To show properties of ports, including which one is input and which output:

[noniwoo@noniwoo-lap articles]$ jack_lsp -p
system:capture_1
	properties: output,physical,terminal,
system:capture_2
	properties: output,physical,terminal,
system:playback_1
	properties: input,physical,terminal,
system:playback_2
	properties: input,physical,terminal,
alsaplayer-1737:out_1
	properties: output,terminal,
alsaplayer-1737:out_2
	properties: output,terminal,
metro:120_bpm
	properties: output,
simple:input
	properties: input,
simple:output
	properties: output,
dftvisualize:input
	properties: input,

After making connections you can list them

[noniwoo@noniwoo-lap articles]$ jack_lsp -c
system:capture_1
system:capture_2
system:playback_1
   metro:120_bpm
system:playback_2
   metro:120_bpm
alsaplayer-1737:out_1
   dftvisualize:input
alsaplayer-1737:out_2
metro:120_bpm
   system:playback_1
   system:playback_2
simple:input
simple:output
dftvisualize:input
   alsaplayer-1737:out_1

Notice that connections are listed symmetrically - if A is connected to B, then B is also listed as connected to A.

alsaplayer-1737:out_1
   dftvisualize:input
dftvisualize:input
   alsaplayer-1737:out_1

You can also see that port metro:120_bpm is connected to two ports simultaneously.

metro:120_bpm
   system:playback_1
   system:playback_2

You can get more information about jack_lsp by using -h switch.

[noniwoo@noniwoo-lap articles]$ jack_lsp -h
jack_lsp: JACK Audio Connection Kit version 0.125.0

Usage: jack_lsp [options] [filter string]
List active Jack ports, and optionally display extra information.
Optionally filter ports which match ALL strings provided after any options.

Display options:
        -s, --server <name>   Connect to the jack server named <name>
        -A, --aliases         List aliases for each port
        -c, --connections     List connections to/from each port
        -l, --latency         Display per-port latency in frames at each port
        -p, --properties      Display port properties. Output may include:
                              input|output, can-monitor, physical, terminal

        -t, --type            Display port type
        -u, --uuid            Display uuid instead of client name (if available)
        -U, --port-uuid       Display port uuid
        -h, --help            Display this help message
        --version             Output version information and exit

For more information see http://jackaudio.org/

jack_connect

[noniwoo@noniwoo-lap articles]$ jack_connect metro:120_bpm system:playback_1

jack_disconnect

[noniwoo@noniwoo-lap articles]$ jack_disconnect metro:120_bpm system:playback_1

njconnect

njconnect is a curses based program to manage jack connections. Curses means that it uses text to create user interface but in a more interactive, nicer way than just using simple command line. It may be nice alternative to qjackctl as njconnect has much less dependencies.

njconnect source is at https://sourceforge.net/projects/njconnect/. It is not very popular (why?) so you may need to compile it manually. It comes with makefile, so it shall be easy. In Arch Linux it is available from AUR.

To run njconnect just type njconnect in command line.

njconnect allows you to manage audio and midi connections of jack. If you do not see any connections or output ports press a to display audio connections.

To get additional help press ?.

To quit njconnect press q.

To move between items use up and down arrows.

To move between windows (output ports, input ports, audio connections) use tab.

To make connection between selected ports press enter or c.

To delete connection selected in Audio connections window press d.

To refresh ports and connections press r. njconnect usually refreshes automatically when new port is created/deleted or there is a change in connections, but sometimes you may need to force refresh manually.

Keys used to control njconnect are reasonably set so time to learn it is almost 0.

qjackctl

qjackctl is a full blown gui program to control jack (including connections). It is available from http://qjackctl.sourceforge.net/, but most Linux distributions shall have package for it.

It may be used to start jack, control many of its parameters and manage connections between jack ports.

To make connections between ports click "Connect" button of main window to see Connections window. To connect/disconnect two ports select them and click "Connect" in Connections window. If in doubt experiment or search internet or youtube.

List of applications using jack

There are a number of applications that can use jack to transport audio data. Example list is at jack's home page http://jackaudio.org/applications/.

Some applications use switch in command line to use jack (eg. jaaa -J). Some may require to run jack before starting program to expose options to use jack (eg. Audacity).


Article written 27.11.2016