Ubuntu 10.x, NVidia HDMI Audio Out

I recently finally managed to get my mits on the Lenovo Q150, the idea to use it as media PC.

Obviously I wanted to run a breed of Linux on it, so that I could run XBMC on it quickly, and have now fast access to my NAS using NFS.

I decided to run with Ubuntu 10.04 (Lucid Lynx).

Loose Lynx installed onto the Q150 with no probs and everything worked perfectly except I couldn’t get any audio out via HDMI, very frustrating.

A quick Google and it seems a lot of people have had the same problem. I read everything on the subject and there are various answers and workarounds, but no-one appears to have got to the nub of the problem.

Anyway heres how I solved it (in the end!).

The first problem is that the version of Alsa drivers that ship with Loose Lynx don’t see the NVidia HDMI Audio only the onboard Intel card.

You can see this with:

jack@media-3:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC662 rev1 Digital [ALC662 rev1 Digital]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: NVIDIA HDMI [NVIDIA HDMI]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: NVIDIA HDMI [NVIDIA HDMI]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: NVIDIA HDMI [NVIDIA HDMI]
 Subdevices: 0/1
 Subdevice #0: subdevice #0

If you haven’t got at least Alsa 1.0.23, you won’t see the NVidia [HDA NVidia] devices.

There are two solutions to this:

  1. Upgrade your version of Alsa to at least 1.0.23, this guide here will show you how.
  2. Take a chance on the new version of Ubuntu 10.10 – Maverick Meerkat. You can read how to here.

Personally I upgraded my Alsa under Licky Lynx, then later upgraded to Masterbating Meerkat Alpha 3 – and have had no issues.

The next problem you may face is that no matter what combination of options you select on the audio control panel, you still can’t get any sound, which is a touch frustrating.

You will notice that aplay -l, shows 4 sub devices, the first thing you need to ensure is that none of the 4 devices are muted, you can do this using alsamixer (where the number after c is the card number of the NVidia audio shown by aplay -l):

jack@media-3:~$ alsamixer -c1

You should see the 4 devices (S/PDIF, S/PDIF1, S/PDIF2, S/PDIF3), make sure they are all unmuted (press m to unmute a given device), unmuted devices show as ‘oo’ rather than ‘MM’.

Next you need to identify which of the 4 sub devices is actually chucking audio out of the HDMI (I have no idea why there are 4 sub devices and only one works).

I did this from the shell using mplayer to specifically select each device in turn, my sub devices were 1.3, 1.7, 1.8 and 1.9 (which corresponds to the output on aplay -l).

mplayer -ao alsa:device=hw=1.3 test.mp3
mplayer -ao alsa:device=hw=1.7 test.mp3
mplayer -ao alsa:device=hw=1.8 test.mp3
mplayer -ao alsa:device=hw=1.9 test.mp3

Obviously substitute the test.mp3 for something thats available  on your system. mplayer in all cases will appear to be playing the track, however only one sub device will actually make any sound. In my case this was 1.9.

You can at this point manually force most applications to output to device 1.9.

However the best answer is to encourage pulseaudio to use 1.9 by default, so:

jack@media-3:/$ sudo nano /etc/pulse/default.pa

About half way down you should find where you can change the default device whatever works for you:

load-module module-alsa-sink device=hw:1,9

Save that and reboot.

You may still have to play with sound preferences a bit, confusingly you need to set the output to High Definition Audio Controller not High Definition Audio Controller Digital Stereo (HDMI).


Author: Ben King

My name is Ben King, I am a director of an Internet solutions company called bit10 ltd. My ultimate responsibility is to bring in the work that bit10 delivers. However I also do a myriad of other things, for example system design, and administration. Outside work I go out, I drink, I socialise, I cook, I have fun, oh and I play a little bit too much World of Warcraft!

4 thoughts on “Ubuntu 10.x, NVidia HDMI Audio Out”

  1. Thankyou! This procedure worked for me. My working device was 2.7 and reboot was not required. I had tried a similar procedure from other sites but nobody had suggested testing each sub-device for sound first. Thanks again.

  2. Thankyou for this brilliant information, I never would have figured this out otherwise. I have an Nvidia GTX460 and I’ve been trying to get HD sound from the HDMI output for a long time without success. My audio was coming out of subdevice 1.7. After updating Pulse audio I had to change the settings in Sound Preferences – Hardware – Settings for selected device, from Digital stereo (HDMI) output to Digital surround 5.1 (HDMI) nr 2 output to get sound.

Leave a Reply

Your email address will not be published. Required fields are marked *