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

richardr picture richardr · Oct 6, 2012 · Viewed 14.6k times · Source

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!

Answer

richardr picture richardr · Oct 7, 2012

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.