Gigabyte Front Panel Audio with Linux

On some Gigabyte motherboards (including the Gigabyte Gaming 5) there are issues with front panel audio not playing. Speakers plugged directly into the motherboard are detected by Linux and play audio as expected. Front panel speaker connections appear in Volume Managers as expected but no sound is played.

A look at the hardware in question:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]  
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]  
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]  
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]  
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 1: ALC1220 Digital [ALC1220 Digital]  
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 4: ALC1220 Analog [ALC1220 Analog]  
  Subdevices: 0/1
  Subdevice #0: subdevice #0

card 0 is the sound output from the graphics card and card 1 is the on-board audio controller. The on-board audio has two analog devices: 0 and 4.

By default, pulseaudio only sees one of those devices:

$ pacmd list-sinks

2 sink(s) available.  
    index: 7
    name: <alsa_output.pci-0000_09_00.1.hdmi-stereo>
    driver: <module-alsa-card.c>
    ...
  * index: 15
    name: <alsa_output.pci-0000_12_00.3.analog-stereo>
    driver: <module-alsa-card.c>
    ...
    card: 1 <alsa_card.pci-0000_12_00.3>
    module: 7
    properties:
            ...
        alsa.device = "0"
        alsa.card = "1"
        ...

Device 0 happens to the be the rear output.

Fortunately, we can tell pulseaudio about the second device:

pacmd load-module module-alsa-sink device=hw:1,4  

Now, listing the sinks shows all three:

3 sink(s) available.  
    index: 7
    name: <alsa_output.pci-0000_09_00.1.hdmi-stereo>
    driver: <module-alsa-card.c>
    ...
    index: 16
    name: <alsa_output.hw_1_4>
    driver: <module-alsa-sink.c>
    ...
    properties:
        ...
        alsa.device = "4"
        alsa.card = "1"
        ...
  * index: 28
    name: <alsa_output.pci-0000_12_00.3.analog-stereo>
    driver: <module-alsa-card.c>
        ...
    properties:
                ...
        alsa.device = "0"
        alsa.card = "1"
                ...

An existing audio stream can be moved to the new sink by finding its input id and moving it with move-sink-input:

$ pacmd list-sink-inputs
1 sink input(s) available.  
    index: 205
pacmd move-sink-input 205 16  

Did this information save you hours of endlessly spamming alsa commands? Do you have audio coming out of your headphones? Say thanks and help keep this site ad & analytic free by buying from Amazon within 24 hours of clicking my Affilliate URL. Or, consider donating some BTC (1DNwgPQMfoWZqnH78yt6cu4WukJa3h8P1f) or ETH (0xf3c4a78c24D34E111f272Ac2AC72b1f01ba52DF3).