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 02:39]
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 18: Line 16:
 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. 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.
  
-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 [[ajsnapshot|aj-snapshot]]. You should learn JACK, how to use it effectively and efficiently,​ and how to integrate it with your system. ​+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. ​
  
 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. 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.
Line 33: Line 31:
   *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.   *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.+JACK is a tool that you start and stop in the unix shell, so it will not appear in your **Menu**.
  
-===== Starting JACK =====+====== 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|]]