JACK Audio Connection Kit

This chapter is intended to form the basis of a more in-depth look at the JACK server

Getting to Know JACK (QjackCtl)

Control Panel Connections

All internal Audio and MIDI connections and routing are controlled by the JACK Audio Connection Kit Control Panel (QjackCtl). These are flexible connections that can be made between all Audio/MIDI software programs, which are known as JACK clients.

The JACK GUI interface can be launched from Sound & Video > JACK Control. The connections can be viewed by pressing the Connect button.

All being well you'll see the word Started come up in the window with 0 (0) below it. The Connections panel should show alsa_pcm in both the input and output windows. If so, you're ready to make some music. This panel shows all Audio or MIDI signal sources in the left pane (Readable Clients / Output Ports) and all possible Audio or MIDI signal destinations in the right pane (Writable Clients / Input Ports).

Main JACK Control Window


Actual connections are established between source (Output Ports) and destination (Input Ports) by selecting one item in either side and pressing the Connect button at the bottom-left of the Connections window.

JACK connections


It is also possible to establish a connection by dragging an item and dropping it on to the other side (Note: it doesn't matter which side you start dragging from).

If it hass not all gone so smoothly, click on Messages, if you see anything much more complicated than:

20:19:41.579 Client activated.
20:19:41.583 Audio connection change.
20:19:41.617 Audio connection graph change.

then you're going to need to do some work to get the best out of this. If you only want to use one application at a time, you may not need to worry about JACK too much right now. However, if you want the full power of a Linux Audio system then it's worth taking the time to figure this out. The Status button also provides some slightly less verbose information.

I/O

To disconnect a currently established connection you proceed in similar manner: select each item on either side and press the Disconnect button. Actual and established connections are shown as coloured lines in between the two panes of the Connections window. Each color indicates a single and distinct source module (client) that is currently connected. It is possible to route all Audio and MIDI signals wherever you want this way.


JACK Patchbay

All connections made in the JACK Control interface persist as long as the JACK session lasts. To maintain a custom and persistent connection layout you'll have to edit and activate a patchbay definition profile. Patchbay definition profiles are connection models that are edited and created on the JACK Patchbay window, which is accessed via the Patchbay button on the main JACK control panel.

The JACK Patchbay window is very similar to the Connections one. However, it is here where you prepare and set your intentional persistent connections, not actual connections. When activated, this patchbay definition profile will keep all declared connections automatically, as long as the JACK Control Panel is kept active.

Following the JACK Patchbay model, you declare connections between sockets (clients). When two sockets are said to be connected, it is implied that each one of its plugs (ports) is declared to be connected in turn, one by one, on a one-to-one basis.

Take special note of the plug/port order in the socket plug list, as each plug and socket are connected in the order they are listed.

JACK Setup

The qjackctl settings panel is accessed from the Setup... button.

The Server Path should be set to jackd and the Driver to alsa. For Parameters you probably want to check Realtime for most work and Softmode to start with. Softmode means that JACK doesn't quit if you get odd xruns, obviously, you won't want this if you're recording. If you know your machine only works at 16bit resolution check Force 16bit. You'll probably want to leave most settings where they are.

If you're operating in realtime, your Priority should usually be 0, but some soundcards differ. Frames/Period is worth setting at the maximum to start and then working your way down. This setting affects your latency most directly, setting it too low will result in xruns. Sample Rate probably wants to be 44100 (CD quality) but some soundcards prefer 48000 (DAT quality). Periods/Buffer almost certainly wants to be 2, but again, your soundcard may vary. Interface probably should be hw:0 or whatever you specified in your ~/.asoundrc if you use one (it is not required). Audio try Playback only if you're having trouble, mostly you'll want full Duplex. Dither - Shaped is best but CPU hungry, Triangular gives a good compromise, you don't _need_ dithering, so None will do for now. Timeout and Start Delay might want to be increased in certain situations.

OK your new settings Stop if JACK is still running and Start again. You may need to play with the settings a bit to get satisfactory results.

Xruns - Overruns

During recording sessions, the Messages panel in Qjackctl may report xruns. Xruns are basically an indications that while Jack is running something gets in the way of it running correctly and it becomes unable to cope with the flow of data causing dropouts in the sound.

Interrupts

If some other card has a higher priority then when it generates an interrupt, if it's slow responding, then possibly Jack and the sound card cannot get their job done.

# cat /proc/interrupts

and

# lspci -v

will give you some valuable information here. Generally speaking, you want your soundcard to be in the highest priority slot (9 or 10) and not sharing with anything. Solutions mostly involve physically moving the soundcard up to a higher slot and/or disabling unused hardware in the BIOS.

Hard drive speed is too slow

You can test your hard-disk performance with:

# hdparm -tT /dev/hda

(or whatever drive you use for audio) A/DeMuDi installs with optimal settings for most drives. You shouldn't need to edit /etc/hdparm.conf unless you know you do. You can cause irreversible data corruption messing with these settings. Read:

# man hdparm

before you attempt anything.

For more information:

$ zcat /usr/share/doc/jackd/FAQ.gz

Make sure you have:

tmpfs /dev/shm tmpfs defaults 0 0

in your /etc/fstab - it makes a big difference!

links

JACK
http://jackaudio.org/
http://jackit.sourceforge.net/docs/faq.php
http://lau.linuxaudio.org/jack/

Linux and Latency
http://www.sabi.co.uk/Notes/linuxSoundLatency.html