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

From Official Kodi Wiki
Jump to navigation Jump to search
>NedBot
m (Bot: Automated text replacement (-__NOEDITSECTION__ + ); cosmetic changes)
>NedBot
m (Robot: Changing Category:How To to Category:How-to)
Line 155: Line 155:
If everything goes well, by now you are listening to the audio over HDMI. Enjoy!!
If everything goes well, by now you are listening to the audio over HDMI. Enjoy!!


[[Category:How To]]
[[Category:How-to]]
[[Category:Linux]]
[[Category:Linux]]
[[Category:NVidia]]
[[Category:NVidia]]

Revision as of 22:33, 11 September 2011

Template:XBMC wiki toc Inline   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 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

alsamixer

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 cat <<EOF>> /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
  }
}
EOF
  • 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.

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
exit

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
exit

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):

cat <<EOF>> ~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"
}
EOF

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.

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.

 <audio>
       <resample>48000</resample>
 </audio>

If everything goes well, by now you are listening to the audio over HDMI. Enjoy!!