[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Testing ALSA and writing an appropriate .asoundrc



On Mon, 13 Aug 2012 08:42:20 +0200
José Luis Segura Lucas <josel.segura@gmx.es> wrote:

> Hi all!
> 
> I have a little mess up with ALSA on one of my computers.
> 
> The computer has two sound cards: one of them, an integrated Intel
> (lspci related output in [1]) and a audio device from Nvidia, for using
> with an HDMI video and audio cable (see [1]).
> 
> Both cards are supported (the Nvidia one, through the proprietary Nvidia
> driver, I suppose). I can put sound on both using a program that allows
> selecting the audio output (I'm currently using Smplayer, a Mplayer
> front-end).
> 
> My problems began when I tried to make the HDMI sound output (the nvidia
> card) as the default for the whole system. I tried with Pulseaudio, but
> configuring it from Gnome brokes my gnome session and I have uninstalled
> whole Pulseaudio stuff.
> 
> I know that you can select the default sound output using a ~/.asoundrc
> file, and I already tried, but I can't get it properly working.
> 
> How can I check with aplay/speaker-test ALSA tools the right syntax for
> both cards? How can I make the HDMI one the default for my whole system?

Use 'aplay -l' / 'aplay -L' to find the names of your cards. On my system:

~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: AD198x Digital [AD198x Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Device [USB Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

So 'Intel' is one (the builtin Intel sound card), and 'Device' is
another (it happens to be the C-Media USB sound device currently
attached).

My .asoundrc contains:

pcm.builtin { type hw; card Intel; }
ctl.builtin { type hw; card Intel; }

pcm.usb { type hw; card Device; }
ctl.usb { type hw; card Device; }

pcm.!default pcm.usb
ctl.!default ctl.usb

Explanation (AFA my limited understanding goes):

The pcm.xxxx and ctl.xxxx lines define cards - the former for the audio
output interface, and the latter for the control (mixer) interface.

So I have defined two logical cards (each with an audio interface and
mixer interface), one for the 'Intel' card, and one for the
'Device' (USB) card.

The 'pcm.!default' lines tell the audio subsystem which cards to use
for the audio output and the mixer [and these defaults are independent
- you can have situations where the sound is going out by default
through one card, but the mixer is defaulting to a different card -
headache ;)].

So I currently have the system defaulting to the USB device. When I
don't want it, I just comment out the last two lines. [There's
doubtless some 'correct' way to automate this via udev or suchlike, but
I haven't bothered.]

> Best regards and thanks in advance
> 
> [1] $lspci | grep -i audio
> 00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High Definition
> Audio Controller (rev 02)
> 02:00.1 Audio device: NVIDIA Corporation High Definition Audio
> Controller (rev a1)

As above, lspci is less useful here than the aplay list commands.

Celejar


Reply to: