'How do I configure JACK audio server to automatically use a specific card?

I'm running Ubuntu 12.04 studio on a HP Pavilion dm1 4200sg netbook. It's pretty much a fresh install. I try to start jackd server by running

jackd -R -d alsa

and it fails with output:

JACK server starting in realtime mode with priority 10
control device hw:0
control device hw:0
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
control device hw:0
ALSA: Cannot open PCM device alsa_pcm for playback. Falling back to capture-only mode
Cannot initialize driver
JackServer::Open() failed with -1
Failed to open server

Running aplay -l gives the following output:

**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 0: STAC92xx Analog [STAC92xx Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0

I find that by running

jackd -R -d alsa -d hw:1

jackd starts successfully. I would like to configure my machine so that hw:1 is the default option (i.e. to make the original 'jackd -R -d alsa' command work). Can anyone help me to do this?

I've tried editing ~/.asoundrc to be

pcm.!default {
     type hw
     card 1
}

ctl.!default {
     type hw
     card 1
}

but this doesn't seem to work. I'm well out of my comfort zone here and any help would be appreciated. Thanks!



Solution 1:[1]

I've found a workaround. It doesn't configure JACK server but alters the order the sound cards are listed.

I first entered into the terminal:

sudo lshw -c multimedia

which showed which modules the two cards were using. They were both using 'snd-hda-intel'.

I then entered into the terminal:

cat /proc/asound/card0/id
cat /proc/asound/card1/id

Which gave ids 'Generic' and 'SB' for cards 0 and 1, respectively.

I then added the following two lines to the end of the file '/etc/modprobe.d/alsa-base.conf'

options snd-hda-intel id=SB index=0
options snd-hda-intel id=Generic index=1

After rebooting the machine, card 'SB' was loaded into position 0 and

jackd -R -d alsa

correctly started.

Solution 2:[2]

First, in a terminal window, run this command: cat /proc/asound/cards. You’ll see output a bit like this:

 0 [SB             ]: HDA-Intel - HDA ATI SB
                      HDA ATI SB at 0xfcef8000 irq 16
 1 [DSP            ]: H-DSP - Hammerfall DSP
                      RME Hammerfall DSP + Digiface at 0xfcff0000, irq 20
 2 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xfe57c000 irq 32

The “name” of each soundcard is in square brackets.

With this information, you can now refer to a particular device as, for example hw:DSP now you can execute the command:

jackd -d alsa -d hw:DSP

And thats all, taken from: http://www.jackaudio.org/faq/device_naming.html

EDIT: added code tags

Solution 3:[3]

  • First, open up alsa-base.conf: sudo gedit /etc/modprobe.d/alsa-base.conf

  • Find the following line: "options snd-hda-intel index=-2"
    And change it to: "#options snd-hda-intel index=-2"

Restart your machine and try again. You may have to set the proper sound device (alsa) for your programs.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gerry
Solution 2 Community
Solution 3