Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
jack [2015/05/26 01:58]
slackermedia
jack [2021/06/03 19:48] (current)
Line 1: Line 1:
-[[{arrowp.png|border:​0;​background:​none;​width:​0;​display:​inline-block;​position:​absolute;​top:​0;​left:​0;​}dep|]] 
  
-[[{arrown.png|border:​0;​background:​none;​width:​0;​display:​inline-block;​position:​absolute;​top:​0;​margin-left:​2.5em;​}sound|]] 
  
 ====== JACK ====== ====== JACK ======
Line 16: Line 14:
 JACK is an application that, once started, runs in the background and enables the user to freely route audio from any application to any other application. It is a system-wide implementation of what other audio applications can only do internally, and is one of the true "​killer"​ features of Linux audio. JACK is an application that, once started, runs in the background and enables the user to freely route audio from any application to any other application. It is a system-wide implementation of what other audio applications can only do internally, and is one of the true "​killer"​ features of Linux audio.
  
-Whether or not you use JACK on a daily basis or just once a year depends on what you do with your computer. ​There are three varieties of audio applications ​on Linux:+Whether or not you use JACK on a daily basis or just once a year depends on what you do with your computer. ​Most everyday ​applications ​are not designed to use JACK at all (ie, it has not been programmed to use be "​JACK-aware",​ but being open source, there are hacks around that), while others use JACK an an option, and still others require JACK to even launch successfully.
  
-  *Those that are not designed to use JACK (ie, it has not been programmed to use be "​JACK-aware",​ but being open source, there are hacks around that). These are usually the "​normal"​ consumer apps, such as web browsers, media players, games, and so on). +If you think you will use JACK because you do pro audio, ​then you should ​read this section ​and the related topics ​about the JACK frontends, [[qjackctl|qJackCtl]] (an all-in-one JACK configurator and patchbay manager), or [[patchage|Patchage]] along with the session manager [[aj|aj-snapshot]]. You should learn JACK, how to use it effectively and efficiently,​ and how to integrate it with your system. ​
-  *Those in which JACK is optional. This can include consumer apps as well as pro audio applications that are designed to be self-contained.  +
-  *Those that require JACK in order to run. These include many professional-level audio and video applications (although not all). +
- +
-Given that JACK isn't just a service that you can install and activate and forget about, but an interactive sound server, it may be overkill. If you don't use pro audio applications,​ it's likely that you will never use JACK.  +
- +
-If you think you will use JACK because you do pro audio, read this section ​to learn about JACK, how to use it effectively and efficiently,​ and how to integrate it with your system. If not, you can skip this section; just install ''​Jack2''​ from [[http://​slackbuilds.org]] just in the event that it's a soft requirement for other applications that you may use.+
  
 +If you do not intend to use JACK, you can skip this section, but install ''​Jack2''​ from [[http://​slackbuilds.org]] just in the unlikely event that it's a soft requirement for some other applications that you may use later. Jack is not terribly large and it won't get in the way unless you manually start it, so it's worth having.
  
 ===== JACK Versions ===== ===== JACK Versions =====
  
-There are two concurrently supported versions of JACK: ''​Jack''​ version 1 (numbered as Jack 0.x) and Jack version 2 (numbered as 1.x, and marked as ''​Jack2''​ on SlackBuilds.org). They are interchangeable and both basically do the same thing, ​but Jack2 includes significant additional features ​such as true multi-processor support, hot-pluggable application interaction,​ and network support (useful for integrating your Linux system with a hardware mixer, for example).+There are two concurrently supported versions of JACK: ''​Jack''​ version 1 (numbered as Jack 0.x) and Jack version 2 (numbered as 1.x, and marked as ''​Jack2''​ on SlackBuilds.org). They are interchangeable and both basically do the same thing. If you install the wrong versionneither you nor applications that use it will ever notice. However ''​Jack2'' ​includes significant additional features ​that make it worth using over the original: ​true multi-processor support, hot-pluggable application interaction,​ and network support (useful for integrating your Linux system with a hardware mixer, for example).
  
 For most users, ''​Jack2''​ is the best option. For most users, ''​Jack2''​ is the best option.
  
-However, [[http://​slackbuilds.org]] lists ''​jack-audio-connection-kit''​ as a dependency for many of packages that actually only require //either// version of JACK.+However, [[http://​slackbuilds.org]] lists ''​jack-audio-connection-kit''​ as a dependency for many of packages that actually only require //either// version of JACK. For this reason, you must:
  
 +  *Install ''​jack2''​ from [[http://​slackbuilds.org]] or ''​jack''​ from [[http://​www.slackware.com/​~alien/​slackbuilds/​jack/​]] (despite the differing names, //both// actually install "​jack2"​.
 +  *Whenever you see the requirement of "​jack-audio-connection-kit"​ on Slackbuilds.org,​ rest easy in the knowledge that you have the ''​jack''​ dependency resolved.
  
 +JACK is a tool that you start and stop in the unix shell, so it will not appear in your **K Menu**.
  
 +====== Starting JACK ======
  
 +<WRAP info>
 +**TL;DR**
 +  -aplay -l | grep card
 +  -jackd -R -d alsa -X seq -P hw:?? -C hw:??
 +</​WRAP>​
 +
 +To start JACK, open a terminal and type in a sensible JACK command, as a normal user (//not// as root).
 +
 +<WRAP important>​
 +If you are using an [[sound|ALSA-to-JACK hack]], you probably need to load ''​snd-aloop''​ unless you have set it to load at boot time.
 +</​WRAP>​
 +
 +For example:
 +
 +<​code>​
 +$ jackd --realtime \
 +-d alsa \
 +--midi seq  \
 +--playback hw:0
 +</​code>​
 +
 +Decoded, this means:
 +
 +  *jackd: invokes JACK, specifically the JACK daemon ''​jackd''​. It will happily run in the background once launched, but you must not close the terminal window you used to launch it.
 +  *''​--realtime'':​ opts for realtime performance. As long as you have set JACK up correctly, realtime or near-realtime performance will be possible (although it is also dependent upon your physical hardware).
 +  *''​-d'':​ driver, with the backend of ''​alsa''​ because that's what Linux uses for its most basic audio system.
 +  *''​--midi'':​ driver for MIDI data streams, with the backend of ''​seq''​ (sequencer),​ because that's the most compatible option and inherits the ability to be controlled and routed by JACK (ALSA MIDI does not). The ''​seq''​ option drives, generally, most USB MIDI devices (such as keyboards and controllers). It may not work for more complex devices like hybrid hardware and software synth controllers.
 +  *''​--playback'':​ the audio device to use for playback, set to ''​hw:​0''​.
 +  *Missing from this example is ''​--capture'',​ which would be set to a capture device such as ''​hw:​1'',​ if required.
 +
 +Most of this is either self-explanatory or else you can just take on faith for now and forever until something important doesn'​t work for you (if you buy a MIDI-capable interface and ''​--midi seq''​ no longer works, then you'll know to investigate alternate drivers.
 +
 +The most confusing decision will be the playback and capture devices, especially intimidating due to the unfamiliar names like ''​hw:​0''​. But don't panic; these are just abbreviations for card numbers as seen in
 +
 +<​code>​
 +$ aplay -l | grep card
 +</​code>​
 +
 +or 
 +
 +<​code>​
 +$ cat /​proc/​asound/​cards
 +</​code>​
 +
 +You have only to determine which output and input device makes sense for you, as described in the [[linuxaudio|Linux Audio]] section.
 +
 +For example, given this setup:
 +
 +<​code>​
 +$ aplay -l | grep card
 +card 0: SB [HDA ATI SB], device 0: ALC887-VD Analog [ALC887-VD Analog]
 +card 0: SB [HDA ATI SB], device 1: ALC887-VD Digital [ALC887-VD Digital]
 +card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
 +card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
 +card 3: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
 +card 3: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
 +</​code>​
 +
 +One might set ''​card 0'',​ expressed to ''​jackd''​ as ''​hw:​0''​ as the output device because it is pretty clearly, of the three choices, the analogue speakers.
 +
 +If one was using a digital output, then one might set the output device to ''​hw:​0,​1'';​ that is, using ''​card 0''<​nowiki>'​s</​nowiki>​ digital output port: ''​card 0, device 1''​.
 +
 +If one wanted to use HDMI instead, then the output device would be ''​hw:​1,​3''​ or ''​hw:​1,​7'',​ depending on which physical port one uses (that particular card has both an HDMI and a mini HDMI port, which I can confirm by looking at the back of my computer).
 +
 +If one plugged in a USB microphone to the same computer and re-ran the ''​aplay''​ or ''​cat''​ commands, a new card is available:
 +
 +<​code>​
 +$ aplay -l | grep card
 +card 0: SB [HDA ATI SB], device 0: ALC887-VD Analog [ALC887-VD Analog]
 +card 0: SB [HDA ATI SB], device 1: ALC887-VD Digital [ALC887-VD Digital]
 +card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
 +card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
 +card 2: DSP [Plantronics .Audio 626 DSP], device 0: USB Audio [USB Audio]
 +card 3: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
 +card 3: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
 +
 +$ cat /​proc/​asound/​cards | grep '​\['​
 +0 [SB       ]: HDA-Intel - HDA ATI SB
 +1 [NVidia ​  ]: HDA-Intel - HDA NVidia
 +2 [DSP      ]: USB-Audio - Plantronics .Audio 626 DSP
 +3 [Loopback ]: Loopback - Loopback
 +</​code>​
 +
 +Now the command to start JACK can be altered to suit:
 +
 +<​code>​
 +$ jackd --realtime \
 +-d alsa \
 +--midi seq  \
 +--playback hw:0 \
 +--capture hw:2
 +</​code>​
 +
 +Which makes the capture device (sound input) ''​card 2''​ and the playback device (sound output); the USB microphone and the analogue speakers, respectively.
 +
 +===== Adding missing devices to JACK =====
 +
 +If a device isn't available in JACK, you can add it using the ''​alsa_in''​ command along with the device designation you get from the ''​aplay -l | grep card''​ output.
 +
 +<​code>​
 +$ alsa_in -d hw:2 &
 +</​code>​
 +
 +Now the device is available to JACK.
 +
 +===== Routing JACK =====
 +
 +Launching JACK with the basic infrastructure of where //you// want to hear sound, and, optionally, from what peripheral you want to be able to input sound, is all you need to get started with music-making on Linux. Once JACK is running, you can use any number of graphical frontends to route sound in and out of one application to another, and from one speaker to another, as needed.
 +
 +The popular frontends for JACK are:
 +
 +  *[[patchage|Patchage]]:​ a node and noodle view of audio inputs and outputs.
 +  *[[qjackctl|QJackCtl]]:​ a full command center with access to sound routing, JACK configuration,​ patchbays, and sessions.
 +  *Cadence: a diverse and multi-purposed control center from [[http://​kxstudio.sourceforge.net|KXstudio]]
 +
 +{{ muse.jpg?​700 }}
 +
 +This section covered, in great detail, the way JACK routes sound and how ALSA lists peripherals. That means that you are equipped to use JACK to route signals in and out of the //​computer//​ but you have not actually tried routing sound in and out of the //​software//​ running on the computer yet. 
 +
 +<WRAP tip>
 +Each individual sound application covered in this handbook will address typical routing schemes, so if you're feeling a little lost or like you have an incomplete picture of what routing sound actually entails, don't worry. Any JACK-aware application in this handbook will be accompanied by advise on how to route the application (but really you'll be able to figure it out on your own).
 +</​WRAP>​
 +
 +Read the sections on [[qjackctl|QJackQtl]] and [[patchage|Patchage]] to learn about routing signals to and from the JACK-aware software you use.
 +
 +Read the [[midi|MIDI]] appendix for detailed information on routing MIDI signals in a meaningful way.
 +
 +<WRAP centeralign>​
 +<wrap fa>​[[colour|R]]</​wrap>​ <wrap fa>​[[start|S]]</​wrap>​ <wrap fa>​[[sound|Q]]</​wrap>​
 +</​WRAP>​
  
-[[{arrown.png|border:​0;​background:​none;​width:​0;​display:​inline-block;​float:​right;​}sound|]][[{arrowp.png|border:​0;​background:​none;​width:​0;​float:​right;​}dep|]]