The Penguin Producer
Media Production with a Linux Twist
The Penguin Producer
Navigation
  • News
  • About
    • Topics
  • Documentation
    • Information
    • Manual
    • Tutorial
    • Tip
    • List
  • Podcast
    • Feed
  • RSS
  • Facebook
  • Twitter
You are here: Home › Tip › Using Multiple Devices with Jack
← Jack-Alsa Bridge Kit
Making Music in the Rosegarden →

Using Multiple Devices with Jack

November 25, 2011 | Filed under: Tip and tagged with: audio, hardware, jack

For the beginning user to the world of Jack, it’s very likely they only have one audio interface; the built-in sound card in their computer.  Setting up Jack in this case is pretty simple, and with the QT Jack Control application, the setting will stick.

However, anyone serious about doing audio production will want something a little more powerful than the built-in sound card, and this can help out immensely, especially as there are a number of good USB microphones on the market.  Once you have a second audio device, though, you’ll notice that Jack won’t allow for that additional device; there seems to be only one room in the Jack Control application for one device.  So, we can’t use more than one device, right?

Wrong.

While the Jack Control program is very flexible, and can provide a lot of the features of the Jack system at your fingertips, it doesn’t provide everything.  Some of the features will still require the command line to make use of them.  In this case, additional audio devices can be connected with Jack after it is started.

The commands you need to use are alsa_out and alsa_in.

Speaker Output

The first command, alsa_out, is used to send Jack output to an Alsa device, like a speaker or headphones.  The following command is actually something I use to connect Jack to the dmix-enabled system speakers, which is useful when I want to hear a recording without the flat response of the studio headphones:

/usr/bin/alsa_out -j "System Speakers" -d dmix:CMI8738 -q 1 2>&1 1> /dev/null &

The connection graph in the Jack Control application will then look like this:

The breakdown is as follows:

/usr/bin/alsa_out

The name and location of the command.

-j "System Speakers"

Sets the name of the device in the connection graph.

-d dmix:CMI8738

In this case, identifies the driver (-d) as the dmix-configured (dmix:) device supported by the CMI8738 chipset (in this case, my Turtle Beach Riviera).

-q 1

Keep the quality low, but passable, so that there is little delay.

2>&1 1> /dev/null

Don’t spit out all kinds of crazy status information. (2>&1 means all error information goes to standard output, and 1> /dev/null means standard output is redirected to the file /dev/null, which in UNIX-type systems means it gets thrown away without being seen or saved)

&

Run the program in the background (when it’s started, you can type the next command, or simply exit out of the window without losing the connection)

 Microphone Input

In the other direction, alsa_in makes other microphones available for recording.  This is useful for USB microphones like the Blue Snowflake that I keep for my laptop, which I will now demonstrate:

/usr/bin/alsa_in -j "Blue Snowflake" -d hw:Snowflake -q 1 2>&1 1> /dev/null &

As you can see, the command is nearly identical to the above one, except the the entry name, and the identified device, which uses “hw:Snowflake” (a direct hardware connection with the device named “Snowflake” by the driver).  The connection graph now looks like this:

Identifying Usable Device Names

You can use these commands using all audio devices that your system recognizes.  You can learn their names through the commands “aplay -l” (for speakers) and “arecord -l” (for microphones).  These commands are available in just about every single Alsa-capable Linux system.  The resulting entries show the information as “card #: Name [Description]“.  The “Name” part is important for the option.

On my system, the following devices are listed between the two commands (in between lists of subdevices which can be safely ignored):

card 0: CMI8738 [C-Media CMI8738]
card 1: SB [HDA ATI SB]
card 4: Loopback [Loopback]
card 5: Track [Fast Track]
card 6: Snowflake [Blue Snowflake]

There is a lot of extra information in the output of those two commands, but the above shows the type of information that is useful when considering the command to use.

One other thing that is useful to remember is the device prefix.  There are several, but these are the most important ones to use:

hw

Direct connection to the equipment; no other sounds can be sent to the device while it’s in Jack’s connection graph, but this provides the smallest amount of latency, as there is no sample rate conversion or audio mixing being performed by dmix or dsnoop.

dmix

Connection to speakers through Alsa’s Dmix plugin.  Dmix is Alsa’s attempt to allow multiple sounds to be sent to speakers at the same time, and have them heard at the same time.

dsnoop

This is like dmix, but is intended for microphones, essentially allowing multiple programs to access the microphone input in Alsa.  Pretty useless if you intend to use Jack to do your recording, especially if you’ve set up the Alsa-Jack bridge devices.

Conclusion

Once you know which device you intend to use, and how you want it connected, you can then assemble the device identifier as “prefix:Name“, after which, you can give the following commands:

alsa_out -j "Description" -d prefix:Name -q 1 2>&1 1> /dev/null &
alsa_in -j "Description" -d prefix:Name -q 1 2>&1 1> /dev/null &

It helps if you learn to make bash script files, because then, you can string all these commands together to make a very easy shortcut to connect all your gear to Jack in one double-click.

With all that gear, you can then go out and make something good!

Did you like this article? Share it with your friends!

Tweet

Written by Lampros Liontos

Lampros “Reteo” Liontos is a long-time user of Linux who had discovered the joy of audio in 2010. His subsequent research of ancient (old) and mystical (technical) tomes of Linux audio lore (documentation) resulted in his decision to make his own, using as close to everyday English as he could manage, and with enough pictures to really help clarify things. Then, he got bored, and decided he wasn’t thinking big enough. Now, he has interest in video, graphics, and audio. Then, he got even more ambitious, and started studying broadcasting. He also likes to write, but that much should have been obvious by now.

Visit my Website Follow me on Twitter
← Jack-Alsa Bridge Kit
Making Music in the Rosegarden →
  • Leigh Dyer

    Thanks for writing this up — it's a question that comes up a lot, and it'll be great to have this page to point people to the next time this comes up!

  • Lampros Liontos

    No problem, thanks for the point here! If there are any topics that people want to know, I'll be glad to try and write up some articles if I can.

    I've added your blog to my links page, because it has some pretty interesting information as well, including looks at music apps in Linux (I'm more the voice-over type myself), including an excellent preview look at Ardour 3's features!

  • Fausto

    Great article.
    This solved me a one year problem. I’ve searched a lot and no one solved this problems in the software side. That is why I’m sharing this story here.

    I have a m-audio conectiv sound card, intended for use with turntables and timecoded vinyls. It has two stereo inputs and two stereo outputs. Besides this, the sound card has two rotary knobs (A and B) which should route the sound from analog_input_A/B or computer_output_A/B to the sound card output_A/B. This is handy when you are playing both real vinyl and computer files controlled by a timecoded vinyl. This sound card is almost correctly recognized by alsa. I mean the capture and playback works but no mixer is created to control the volumes. But this is not THE issue.

    What happens in linux is that knob A routes analog_input_B and computer_output_A to the output_A (or some other strange mixed combination). I mean, the channels analog_input_A and B and the computer_output_A and B are swapped to the corresponding A and B outputs. What complicates more the solution is that both channels appear as separated devices and to my knowledge, it was not easy to use jack to re-route those different devices in one jack instance. That was solved by reading your article.

  • bmillham

    Thanks for this! I’ve been looking for this answer for ages. I wanted to get both my wireless USB headset and my wired headset working in IDJC for DJing with 2 DJs. This worked perfectly, and simple to setup 😀

    • Lampros Liontos

      Glad to help!

  • sam

    I may be missing something, I’m trying to set up a USB Mixer to use with jack….. isn’t that both input, and output???

    • Lampros Liontos

      It may be easier to think of an audio interface (a category which includes USB mixers) as a sound card with an immense leap in quality over your run-of-the-mill gaming stuff. In this way, a mixer has both inputs (for the microphone) and outputs (for monitoring headsets and speakers).

      For the sake of using alsa_in and alsa_out, however, you’ll need to use two commands (one of each) in order to get full use out of a separate mixer. However, if you have the one mixer, then I recommend instead using it as the main device for Jack; alsa_in and alsa_out can introduce overhead that may cause xruns.

  • Guest

    Hi, I am having difficulty with jack using more than one device.
    I am using a virtual audio card, with 24 stereo inputs. This is working ok and receiving audio ok.
    When I use jack to capture the audio, it will only use 8 of the inputs, if i try 9 it fails.

    Any ideas???

  • SouthernNYer

    Great info… but I am having no luck. I have a Blue SnowBALL USB mic and an old emachines ET1161-01 tower. I can switch back and forth between the USB mic and my soundcard, but cannot get your commands to work. When I run aplay -l, this is my response: aplay -l

    **** List of PLAYBACK Hardware Devices ****

    card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]

    Subdevices: 0/1

    Subdevice #0: subdevice #0

    card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]

    Subdevices: 1/1

    Subdevice #0: subdevice #0

    card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]

    Subdevices: 8/8

    Subdevice #0: subdevice #0

    Subdevice #1: subdevice #1

    Subdevice #2: subdevice #2

    Subdevice #3: subdevice #3

    Subdevice #4: subdevice #4

    Subdevice #5: subdevice #5

    Subdevice #6: subdevice #6

    Subdevice #7: subdevice #7

    card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]

    Subdevices: 7/8

    Subdevice #0: subdevice #0

    Subdevice #1: subdevice #1

    Subdevice #2: subdevice #2

    Subdevice #3: subdevice #3

    Subdevice #4: subdevice #4

    Subdevice #5: subdevice #5

    Subdevice #6: subdevice #6

    Subdevice #7: subdevice #7

    You see, it doesn’t show the Snowball, even tho it is connected. Any advice?

  • Jakob Alexander Eichler

    Is there a simpler way to do this?
    The command worked, but can I not do that all just in a gui application?

    • Lampros Liontos

      I wish I had an answer for you. Unfortunately, if such a GUI tool exists, I am not aware of it.

Categories

  • ►Blog (3)
    • ►Previews (1)
  • ▼Documentation (68)
    • ►Information (14)
    • ►List (2)
    • ►Manual (9)
    • ▼Tip (24)
      • A Couple Useful Changes to the Blender Default Interface
      • A Tip to Podcasters: Silence is Golden
      • Audio Interface Brands to Consider
      • Balancing Performance and Reliability in Jack
      • Book Animation in Blender
      • Command for Recording Your Desktop
      • Creating Clip Planes in Blender
      • Dalek Voice Effect - Updated
      • Dr. Strangesound, or How I Learned to Stop Worrying, and Love PulseAudio
      • Jack-Alsa Bridge Kit
      • Jack-Based Multichannel Recording
      • LADSPA Noise Removal
      • Mailbox: Making a Karaoke Track from Stereo Music
      • Microphone Recommendations and Explanation
      • Multi-Screen Blender
      • Noise Control Using Packing Blankets
      • Perspective: All One Program
      • Preventing Self-Connections in Jack Apps, AKA Making Ladish Work with Everything
      • Quick Tip: Use Lossless Compression for Your Working Copies
      • Using Figure-8 to Limit Noise
      • Using Hydrogen as a SFX Trigger
      • Using Multiple Devices with Jack
      • Voice Effects
      • Where's Walldo?
    • ►Tutorial (19)
  • ►Media (12)
    • ►Audio (1)
    • ►Graphics (6)
      • ►Computer Generated Graphics (4)
      • ►Illustration (1)
      • ►Photography (1)
    • ►Video (5)
      • ►Animation (2)
      • ►Compositing (1)
      • ►Film (1)
  • ►News (14)
  • ►Podcast (6)
  • ►Site Recommendations (1)
  • ►Uncategorized (2)

Communities

  • Blender Artists Community
  • GIMP Forums
  • GIMP Talk
  • GIMPER.NET
  • Inkscape Users Forum
  • Linux Musicians
  • Linuxaudio.org

Hardware Support

  • Alsa PCI and USB
  • FFADO Firewire
  • Linux-drivers.org

Tutorials

  • Blender Guru
  • GIMP Tutorials
  • Inkscape Tutorials Blog
  • Libre Graphics World
  • Screencasters (Inkscape Tutorials)

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
November 2011
S M T W T F S
« Oct   Dec »
 12345
6789101112
13141516171819
20212223242526
27282930  

Penguin Producer Tip Jar

The Penguin Producer by Lampros Liontos is licensed under a Creative Commons Attribution 3.0 Unported License.

Powered by Esplanade Theme and WordPress