Knowing Jack Knowing Jack
Total Page:16
File Type:pdf, Size:1020Kb
LINUXUSER JACK audio server Exploring the JACK sound server system KNOWINGKNOWING JACKJACK www.photocase.com The JACK audio server offers a professional sound alternative for the Linux desktop. BY DAVE PHILLIPS ost Linux users know that a cording, the demands on an audio server and dropouts (known as xruns), and server provides services, are relatively light. Managing several such systems are expected to support Mwhether on one machine or on audio streams at this level requires no the synchronous operation of multiple a network. The purpose of a server is to sample-accurate synchronization, nor is clients in a low-latency environment. eliminate the need to directly access there a need for a highly flexible client JACK comes with features such as: these services at the application level. routing system. Most users simply want • support for any ALSA-compatible For example, an X server manages access to be able to play recorded audio with- sound device to and control of the video services of out blocking other audio streams. Artsd • support for a variety of audio system the computer’s graphics chipsets, reliev- and esd are sound servers designed to back-ends (ALSA, OSS/ Linux, Port- ing user-level application developers of meet these requirements for the KDE Audio, CoreAudio) the burden of programming for those and GNOME desktops. The Network • free connectivity between clients – services directly. Audio System (NAS) is an alternative without delays or dropouts An audio server manages access to the network-friendly client/ server audio de- • support for a master transport control capabilities and services of the installed livery system intended to serve as an system audio devices. These audio devices in- audio equivalent of the X server. Within JACK’s primary task is the management clude soundcards, on-board audio chip- their limits, Artsd, esd, and NAS all of multiple audio data streams, coming sets, and any other audio hardware function effectively. However, none of from and going into a variety of appli- (such as telephony hardware, combined these servers provides sample-accurate cations with synchronized I/ O. JACK A/ V cards, television, and radio boards). synchronized I/ O of multiple audio data requires an audio system – it is not a The graphic Linux desktop depends streams, nor were they designed for per- replacement for an audio system such upon X for its graphics and video ser- formance within low-latency systems. If as ALSA or OSS/ Linux. JACK does not vices. Thus, your favorite KDE or your audio needs require these high-end supply soundcard drivers, nor does it GNOME applications include routines capabilities, you have ventured into the access hardware directly; instead it de- for accessing those services through the domain of professional audio systems, pends on a low-level audio layer to han- X application's programming interface. and now you need to know JACK. dle that communication, which in Linux Programmers can code for the hardware is either ALSA or OSS. JACK doesn’t care via a generalized API instead of having Introducing JACK about the underlying hardware, it simply to directly address the hardware. Alas, Developer Paul Davis has created one wants to manage the streams coming the sonic Linux desktop lacks a single of the most remarkable pieces of open- into and out of your devices. standardized solution for serving audio source audio software, the JACK Audio resources system-wide. Instead, a variety Connection Kit, better known as just Building and Installing of solutions have appeared, including JACK. JACK is specifically designed for JACK the artsd, esd, NAS, and JACK systems. systems tuned for low-latency and high JACK is available as a basic package For triggering system sounds, listening demand. Professional audio recording in the AGNULA/ Demudi and Planet to CD and DVD audio, and simple re- systems cannot afford audible delays CCRMA audio-optimized systems. A 76 ISSUE 67 JUNE 2006 WWW.LINUX - MAGAZINE.COM JACK audio server LINUXUSER source tarball of the latest Note that the -p option sets the software public release is available buffer size. As Jack O’Quin points out, from the JACK website. this is the buffer size seen by all JACK The site also provides in- clients. structions for building See the box titled “JACK Options” for JACK from CVS sources Figure 1: Controlling JACK from QjackCtl. more on command line options for for those who want to JACK. keep up with the latest development. No In this example, JACK has been started special build requirements are needed with realtime capability, acknowledging GUIs for JACK for JACK itself beyond Erik de Castro the ALSA back-end and addressing the We have already seen JACK in action at Lopo’s libsndfile audio file I/ O library. first hardware device in the audio the command prompt. However, when According to the JACK FAQ, you must system. The -d hw:0 switch is actually working in an X environment it’s nicer have a recent Linux kernel (2.4 or unnecessary; the hardware selection to have a GUI for JACK’s setup and con- higher) with the tmpfs file system turned always defaults to hw:0 anyway. Obvi- figuration, and thanks to developer Rui on. Most modern distributions will have ously, you would use a different number Nuno Capela, we have the wonderful this turned on by default, but you can for a different card or chipset in a system QJackCtl (Figure 1). This most helpful check for it by running cat /proc/filesys- with multiple sound devices. utility provides an all-in-one graphic in- tems. The FAQ also states that you must Here’s a slightly more complex exam- terface for configuring and controlling all mount a shared memory filesystem on ple for my SBLive soundcard : of JACK’s operations. In addition to the /dev/shm, advising that the following convenient setup dialog (Figure 2), QJC line be added to /etc/fstab: jackstart -R -d alsa -d hw:1U supplies an audio connections panel for -p 512 -r 48000 -z s JACK clients and a set of basic JACK shmfs /dev/shm shm U transport controls (if you want to use defaults 0 0 Once again, we see the realtime and QJC as the JACK transport master). QJC ALSA options. The device selector is further supplies messaging and status The FAQ further notes that you may numbered hw:1 because the SBLive is display panels, controls to start and stop have to create the /dev/shm directory the second card in that particular ma- the server, and play/ pause controls for yourself. chine. I’ve added options for the buffer JACK’s transport control system. After unpacking the sources, simply size (-p), for the JACK sample rate (-r), QJC also includes a MIDI connections enter the new JACK directory, read the and for the audio dithering option (-z). panel for ALSA sequencer clients, letting README for up-to-date instructions, then invoke ./configure --help to see the Regarding Soundcards available configuration options. JACK is The audio industry distinguishes be- audio chipset supplies little more than built with the familiar autotools utilities, tween consumer and professional grade the basic services, while my desktop so for most users the compile process is audio devices. Consumer-grade devices machine’s SBLive provides a much as easy as running ./configure [your include PCI and USB audio interfaces, larger array. options here]; make; make install. on-board chipsets for integrated desktop Professional-grade audio boards such as Installing JACK from an RPM or other and laptop sound support, and more ad- the RME Hammerfall or the M-Audio package also requires no special support. vanced hardware such as Creative’s SB Delta cards are designed to satisfy differ- Follow the basic installation procedure Live! and Audigy cards. These devices ent needs, providing higher-quality normally provide channels for a master for your system, and voila, you have a audio connectivity such as AES/ EBU and volume control, PCM and CD audio out- fresh JACK system ready for use. balanced 1/ 4” plugs, a greater number of put, and inputs for microphone and line- audio I/ O channels, higher sampling Starting JACK level signals. The master volume, CD, rates, and hardware synchronization mic, and line channels are self-explana- capabilities. These professional-quality The JACK server is launched with either tory. The PCM channel is a general digi- cards may or may not include hardware jackd or jackstart. The JACK manual tal audio playback channel providing MIDI connectivity, and they do not usu- page (man jackd) tells us that jackd in- volume control for programs playing ally include consumer-grade amenities vokes the JACK server daemon and that WAV, AIFF, OGG, MP3, and other sound- such as an on-board synthesizer or a jackstart is used when using JACK’s file types. connector to your CD drive’s audio built-in support for realtime capabilities. Depending on the audio chipset, these output. All options are the same for either invo- basic services may be expanded to in- The distinction between the grades is cation. For most users working on sys- clude channels for on-board synthesizer obscured by some more advanced de- tems with a patched 2.4 kernel, jackstart output, digital audio connections, sur- vices intended for the consumer market, will be the preferred method of starting round sound channels, and bass/ treble and it is certainly possible to achieve the server. Users working with 2.6 ker- tone controls. Software mixers such as truly high-quality results from some of nels should use jackd. alsamixer poll the audio hardware for its the more modern soundcards. However, capabilities and configure the mixer to Here’s a relatively simple beginning : for truly professional requirements you’ll display the available channels and need professional-grade audio hard- switches.