Logo

SPOT  Spot's Perspective On Technology
Colorful talk in black and white shades of grey.

home
site map
admin

Basic JACK

2004-04-25 05:52:18

What you will need for this bite-sized example

Overview

JACK is a low-latency audio server designed to professional audio standards. If you read the Linux Audio Quality HOWTO, you might get scared off by the time you get to the parts about patching and recompiling your kernel. Relax, jaromil already took care of that for you when building d:b. The howto is still a good read, especially for tips on compatibilities and quality troubleshooting. JACK frees you from many of the traditional limits of Linux sound, providing powerful routing and interconnection capabilities.

For most d:b systems, starting JACK is as simple as picking it from the menus:

AUDIO -> DEEJAY -> Jack daemon :: start live audio engine

This will bring up qjackctl, a control panel, like this:

JACK Control Panel

Many of the various buttons bring up addition control and status windows. Your most used option will likely be the Connect button, which brings up the Connections Panel:

Jack Audio Connections Panel

As JACK enabled programs are launched, they will add ports to the Readable Clients / Output Ports and Writeable Clients / Input Ports lists. Note that your sound card itself is on these lists, typically as alsa_pcm. Some programs will automatically attempt to make a connection from their new output port to the soundcard input port (that might sound confusing at first, remember that input port is really to your soundcards output.) Other programs will establish ports and leave the connections to you. Just click on each port you want to connect, and click the 'connect' button. You can also click and drag from one column to the other. You can connect an entire port group, or expand it to connect just one channel for example, instead of a stero pair. Of course, you can also connect multiple ports, for example, to send two or more audio apps to the soundcard at the same time.

The connections panel also has a MIDI tab, too. It works in much the same way. Also, note the Play button on the main Control Panel. This opens up ways to co-ordinate sophisticated MIDI systems under JACK's transport control, but we will leave that as an area for independent exploration. Just be aware that we've barely scratched the surface in this bite-sized lesson.

Troubles?

If for some reason sound isn't working, or you need to tweak things, here are a few steps that might help in getting it all straightened out. Note that to permanently fix a configuration problem, you will need to nest d:b to hard disk or USB key. Its very simple to do, and provides lots of benefits.

You might also want to check on the Dynebolic Wiki and in the mailing list archives at dyne.org for more tips and suggestions.

Finding out about your soundcard

The first item is to find out what your sound card actually is. There are three main ways a soundcard can be attached to your system. By far the most common in newer machines is by way of the PCI bus. Note that even on-board, or built in, sound connects to a system by way of a bus, usually PCI. Older machines might use the ISA bus, while some new addon sound modules connect with USB. A USB sound module can be enabled with this command:

modprobe snd-usb-audio

For ISA cards you will usually need to know some card specifics to choose the right driver, and it may require entering codes at the boot prompt to fully enable.

For a PCI attached cards, the system can help you determine the details. From an Xterm prompt issue the command 'lspci'. This will list everything that is connected to the PCI bus. You are looking for 'Multimedia audio controller'. Here is a sample output:

[d:b] ~ #lspci                                                                                          14:41
00:00.0 Host bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 03)
00:01.0 PCI bridge: Intel Corp. 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 03)
00:07.0 ISA bridge: Intel Corp. 82371AB/EB/MB PIIX4 ISA (rev 02)
00:07.1 IDE interface: Intel Corp. 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.2 USB Controller: Intel Corp. 82371AB/EB/MB PIIX4 USB (rev 01)
00:07.3 Bridge: Intel Corp. 82371AB/EB/MB PIIX4 ACPI (rev 02)
00:0d.0 Ethernet controller: Davicom Semiconductor, Inc. Ethernet 100/10 MBit (rev 31)
00:0f.0 Multimedia audio controller: C-Media Electronics Inc CM8738 (rev 10)
00:10.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
00:10.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
01:00.0 VGA compatible controller: S3 Inc. Savage 4 (rev 03)
[d:b] ~ #

Notice there are two audio devices in the list, including the Brooktree Video card's Audio portion. We are probaly most interested in the C-Media at this point.

Locate ALSA information for your soundcard

Armed with knowledge of the card, the next step is to visit the ALSA Soundcard Matrix, and look for any additional notes on getting the most out of your card. You may need to modify the /etc/.asoundrc file to take full advantage of the card.

Once you have identifed the ALSA modules appropriate to your soundcard, you need to load the required kernel modules using the modprobe command. For example, the C-Media card would require:

modprobe snd-cmipci

You might also need to add a line or two in /etc/modules.conf for extreme cases. For example, even though it autodetects correctly, the C-Media card needs this line to enable MIDI support:

options snd-cmipci mpu_port=0x300

For cards which don't auto-configure correctly, a permanent fix is to add an entry to /etc/modules.conf as indicated in the ALSA documentation, similar to this:

alias snd-card-0 your-required-module

Tweaking JACK Settings

If sound works, but JACK doesn't, a few tweaks might help. The Messages window might offer a few clues as to what is wrong. Check there, and then click on the Setup button to bring up this panel:

qjackctl Setup Panel

One common problem is the duplex setting ('Audio:' middle right.) Some cards have problems in duplex mode, and selecting Playback instead of Duplex will allow JACK to operate. Also, some cards may require lower or different sample rates or bit sizes, so trying things here might help. Hovering over an option will bring up a help tip to give a better indication of what the control is for. A general word of advice is go slow and methodically. Make one change, and then test, instead of flipping lots of things at random. Persistance will usually reward you.

Now you've got power. Go create something wonderful!

Article 14 was last updated 2004-05-01 12:01:31

Many of the best audio tools in Dyne:bolic require, or can benefit from, the JACK audio connection kit. Here is a bite-sized tour of JACK.