XBMC will be renamed to Kodi for v14. Read here for more details
Various pages on the wiki might contain old references to "XBMC", but will most often still apply to "Kodi". Find out how you can help here.

Archive:HOW-TO:Set up audio over HDMI on nVidia GeForce/nForce controller

From Kodi
Jump to: navigation, search
Time.png OUTDATED:
These instructions are likely not compatible with Frodo AudioEngine builds

All the information described below, taken from XBMC and Ubuntu forum

Note: This method was tested on ASUS P5N7A-VM motherboard [GeForce 9300 / nForce 730i] but it's believed to be working for any nVidia chipset that supports audio over HDMI. Also confirmed to work on ASUS M3N78-EM motherboard [nVidia GeForce 8300]. This method has also been confirmed working for ASUS AT3IONT-I Deluxe edition. For ASUS M78SM-S2H [nVidia GeForce 8200], updating to NVidia driver 310.19 and unmuting S/PDIF 1 was sufficient using XBMCbuntu "Eden" (Lubuntu 11.10 Oneiric Ocelot)
  • This method works pretty well with the default installation of ALSA v1.0.22 (as of Ubuntu 10.04, lucid). There is no need to upgrade ALSA with the alsa-upgrade script.
  • This guide configures ALSA, you should remove pulseaudio first.
sudo apt-get remove pulseaudio

First, check which ALSA playback devices you have, you can use this command:

aplay -l

You should see something like this:

xbmc@htpc:~$ 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

The device is specified as hw:(card),(device). The sample above shows device 3 is labeled "NVIDIA HDMI"; we are gonna use that and it would be called hw:0,3.

Before continuing, run


then make sure "S/PDIF 1" is not set to MM (Mute). If it is, press M to unmute that channel. This was enough to make the sound work on my card. --Sim175 01:37, 5 August 2011 (UTC)

Create the file "/etc/asound.conf", which configures the ALSA library for the user.

sudo nano /etc/asound.conf
pcm.!hdmi-remap {
  type asym
  playback.pcm {
    type plug
    slave.pcm "remap-surround71"
pcm.!remap-surround71 {
  type route
  slave.pcm "hw:0,3"
  ttable {
    0.0= 1
    1.1= 1
    2.4= 1
    3.5= 1
    4.2= 1
    5.3= 1
    6.6= 1
    7.7= 1
Note: This file only has an effect on the ALSA library if it is included by the user’s .asoundrc file, located in the user’s home directory.

The ttable section entries match sound channels (eg front left, centre, sub woofer) to speakers. You may find that you need to change the entries above if you find that your speakers are not playing the right channels afterwards. In particular you may need to change 2.4 to 2.2 and 4.2 to 4.4, as well as 3.5 to 3.3 and 5.3 to 3.5

Next, add the following lines to the end of the "/etc/modprobe.d/alsa-base.conf" file:

# Audio over HDMI
options snd-hda-intel model=6stack-dig

The commands below should do the job:

sudo su -
echo "# Audio over HDMI" >> /etc/modprobe.d/alsa-base.conf
echo "options snd-hda-intel model=6stack-dig" >> /etc/modprobe.d/alsa-base.conf

Now change to "/usr/share/alsa/cards" and replace the default HDA-Intel.conf with the one at pastebin. Don't forget to make a backup copy of the original one before proceeding, in case you need it in future. The command set below should do the job (you will have do this as "root"):

sudo su -
cd /usr/share/alsa/cards
mv HDA-Intel.conf HDA-Intel.conf-ORIG
curl "http://pastebin.com/download.php?i=f2e38265" | tr -d \\r > HDA-Intel.conf

As mentioned earlier, things will only work if there is a ".asoundrc" file in users' home directory; in this case the user is xbmc. So fire up a terminal and create one with the following (assuming the HDMI device is specified as hw:0,3, change it to suit your configuration):

sudo nano ~xbmc/.asoundrc
pcm.dmixer {
   type dmix
   ipc_key 1024
   ipc_key_add_uid false
   ipc_perm 0660
   slave {
      pcm "hw:0,3"
      rate 48000
      channels 2
      format S32_LE
      period_time 0
      period_size 1024
      buffer_time 0
      buffer_size 4096
pcm.!default {
   type plug
   slave.pcm "dmixer"

Make sure that master volume and default PCM devices are not muted.

sudo /usr/bin/amixer -q -c 0 sset 'Master',0 unmute && /usr/bin/amixer -q -c 0 sset 'Master',0 100 
sudo /usr/bin/amixer -q -c 0 sset 'IEC958 Default PCM',0 unmute
sudo /usr/bin/amixer -q -c 0 sset 'IEC958',0 unmute && /usr/bin/amixer -q -c 0 sset 'IEC958',1 unmute
sudo alsactl store 0

This is the time to reboot the system to make changes take the effect. When you log back in, you can test the speakers with "speaker-test" command like this:

speaker-test -D hdmi -c6 -r19200 -FS32_LE

The output should be something like the following. Although if you get a "Playback open error: -16,Device or resource busy" message, go back into XBMC and double check your sound, it may already be working through HDMI ;-)

xbmc@htpc:~$ speaker-test -D hdmi -c6 -r19200 -FS32_LE
speaker-test 1.0.23
Playback device is hdmi
Stream parameters are 19200Hz, S32_LE, 6 channels
Using 16 octaves of pink noise
Rate set to 19200Hz (requested 19200Hz)
Buffer size range from 6 to 544
Period size range from 3 to 273
Using max buffer size 544
Periods = 4
was set period_size = 108
was set buffer_size = 544
 0 - Front Left
 4 - Centre
 1 - Front Right
 3 - Rear Right
 2 - Rear Left
 5 - LFE

It appeared to be important that "Audio Settings" in the XBMC needs to be modified as well. Go to "Settings > System > Audio" and make the entries like the picture below.

Xbmc audio settings.jpg {{|note|The values for the "Custom audio device" are case-sensitive, should be exactly as it's written. Always use the default skin for basic system setup. Now try playing a video or audio file, preferably one with multiple channels, and see If you find you have sound. If you dont, try changing the settings, for example changing Audio output to HDMI. You can also try changing the custom passthrough device and audio output device entries to hw:0,3 or whatever matches your system as explained above under the explanation of aplay -l output}}

You may notice that the mp3 playback is faster than that usual. If that happens put these in the advancedsettings.xml and should fix the problem.


If everything goes well, by now you are listening to the audio over HDMI. If you have sound, but find sounds are not coming out of the correct speakers, check the ttable entry mappings in ./.asoundrc Enjoy!!

Personal tools

Wiki help