Saturday, March 10, 2012

Sound using HDMI from GPU

I began by following the alsa configuration from the arch wiki.


$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]
  Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
  Subdevices: 0/1
Subdevice #0: subdevice #0

Then test your output devices to find which gives you sound. In the example below, 0 is the card number and 3 is the device number.


$ aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav

If the test is successful, create (or edit) your ~/.asoundrc file to set HDMI as the default audio device.

pcm.!default {
   type hw
   card 0
   device 3
}

The trouble was that on each boot, my card numbers changed!
The solution is to follow the advice here on the alsa wiki

It says, use the name of the card rather than the card number. I created a file /etc/asound.conf with the following

# (from /proc/asound/cards)
#
#

pcm.!default {
    type hw
    card Nvidia
    device 9
}

No comments:

Post a Comment