Setting default ALSA output to HDMI audio

From froelix.com - Wiki
Jump to: navigation, search

To view all available ALSA devices run the command aplay -l. You sould see something like that:

$ aplay -l
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: SB [HDA ATI SB], Gerät 0: ALC888 Analog [ALC888 Analog]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
Karte 0: SB [HDA ATI SB], Gerät 1: ALC888 Digital [ALC888 Digital]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
Karte 1: HDMI [HDA ATI HDMI], Gerät 3: ATI HDMI [ATI HDMI]
  Sub-Geräte: 0/1
  Sub-Gerät #0: subdevice #0

In this case the HDMI audio output is device 3 on card 1. To set this as the default ALSA output, create the file /etc/asound.conf with the following content:

pcm.!default {
    type plug
    slave.pcm {
        type hw
        card 1    # HDMI card number
        device 3  # HDMI device number
    }
}

Just restart yor PC. That's it!