A52 (AC3 surround) decoder/emulator through Pipewire Alsa not working

Hello,

I just started to build my NixOS a few weeks ago (using Unstable repo), not ready yet to use it cuz I want to make sure I can configure all I need. I am on Garuda Arch at the moment.

I know the Nix language is quite a challenge for me to grasp, takes time but I learn everyday, that’s what counts!

I do have a lot of difficulties trying to setup my sound correctly. I have spent probably 15+ hours troubleshooting this and reading stuff. I have gathered a lot of information, so much that it may scare people if I post everything loll, but I have to show at least the most important stuff I did/found to get the ball rolling.

My expected result:

I am trying to enable IEC958/AC3 output as you can see here in my Arch installation (this shot is from Plasma System Settings/Audio).

This should enable something similar to the following list of Audio Devices in VLC:

What this does is it passes AC3 through S/PDIF by emulating stereo into 5.1 surround, so it uses all 6 speakers I got, for all sounds produced by the machine, not just the true recordings that are encoded in 5.1 (hence the emulator from stereo to 5.1).

lsof /dev/snd/*
		COMMAND    PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
		pulseaudi 7490 frank   18u   CHR  116,5      0t0  484 /dev/snd/controlC0
		pulseaudi 7490 frank   23u   CHR  116,5      0t0  484 /dev/snd/controlC0
		pulseaudi 7490 frank   24u   CHR 116,11      0t0  526 /dev/snd/controlC1
ps -e | grep pipewire

7027 ? 00:00:00 pipewire

pactl info
Server String: /run/user/1000/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 14
Tile Size: 65472
User Name: frank
Host Name: Garuda
Server Name: pulseaudio
Server Version: 16.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.pci-0000_0c_00.4.iec958-ac3-surround-51
Default Source: alsa_output.pci-0000_0c_00.4.iec958-ac3-surround-51.monitor
Cookie: 4055:16a2
systemctl status | grep -E 'pipewire|pulseaudio|wireplumber'
│ ├─pipewire.service
│ │ └─7027 /usr/bin/pipewire
│ ├─pulseaudio.service
│ │ ├─7490 /usr/bin/pulseaudio --daemonize=no --log-target=journal
│ ├─wireplumber.service
│ │ └─7028 /usr/bin/wireplumber

This is really what I am trying to enable:

Default Sink: alsa_output.pci-0000_0c_00.4.iec958-ac3-surround-51
Default Source: alsa_output.pci-0000_0c_00.4.iec958-ac3-surround-51.monitor

What I do have in Nix right now:

sudo lsof /dev/snd/*
		COMMAND    PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
		pipewire  1691 frank   49u   CHR  116,1      0t0  541 /dev/snd/seq
		pipewire  1691 frank   50u   CHR  116,1      0t0  541 /dev/snd/seq
		wireplumb 1694 frank   37u   CHR 116,11      0t0  828 /dev/snd/controlC1
		wireplumb 1694 frank   39u   CHR  116,5      0t0  802 /dev/snd/controlC0
ps -e | grep pipewire
		1760 ?        00:00:00 pipewire
		2045 ?        00:00:00 pipewire-pulse
pactl info
		Server String: /run/user/1000/pulse/native
		Library Protocol Version: 35
		Server Protocol Version: 35
		Is Local: yes
		Client Index: 69
		Tile Size: 65472
		User Name: frank
		Host Name: Garuda
		Server Name: PulseAudio (on PipeWire 0.3.74)
		Server Version: 15.0.0
		Default Sample Specification: float32le 2ch 48000Hz
		Default Channel Map: front-left,front-right
		Default Sink: alsa_output.pci-0000_0c_00.4.iec958-stereo
		Default Source: alsa_output.pci-0000_0c_00.4.iec958-stereo.monitor
		Cookie: 60db:241d
systemctl status | grep -E 'pipewire|pulseaudio|wireplumber'
		│ │ └─3993 grep --color=auto -E "pipewire|pulseaudio|wireplumber"
		├─pipewire-pulse.service
		│ └─1939 /nix/store/9cnbzcws30p5b3r8cng5dzqdyhxyzmps-pipewire-0.3.74-pulse/bin/pipewire-pulse
		├─pipewire.service
		│ └─1697 /nix/store/jsajy583svnxjbfynfizhnn5aqwy7v61-pipewire-0.3.74/bin/pipewire
		├─wireplumber.service
		│ └─1701 /nix/store/vp3r1lq5vxdrbcgkvqdlpbsm4mbb3z9m-wireplumber-0.4.14/bin/wireplumber
pw-link -o
		Midi-Bridge:Midi Through:(capture_0) Midi Through Port-0
		alsa_output.pci-0000_0a_00.1.hdmi-stereo:monitor_FL
		alsa_output.pci-0000_0a_00.1.hdmi-stereo:monitor_FR
		alsa_output.pci-0000_0c_00.4.iec958-stereo:monitor_FL
		alsa_output.pci-0000_0c_00.4.iec958-stereo:monitor_FR
grep Codec /proc/asound/card1/codec*
		Codec: Realtek ALCS1200A
spa-acp-tool -c 1 lv
card 1: profiles:17 devices:12 ports:6
properties: (8)
use-ucm = "true"
verbose = "true"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
device.string = "1"
device.description = "HD-Audio Generic"
profile 0: name:"off" prio:0 (available: yes)
description:"Off"
devices: (0)
profile 1: name:"output:analog-stereo+input:analog-stereo" prio:6565 (available: no)
description:"Analog Stereo Duplex"
devices: (2)
device 5: direction:playback name:"analog-stereo" prio:65 flags:00000000 devices: "front:%f"
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
profile 2: name:"output:analog-stereo" prio:6500 (available: no)
description:"Analog Stereo Output"
devices: (1)
device 5: direction:playback name:"analog-stereo" prio:65 flags:00000000 devices: "front:%f"
* profile 3: name:"output:iec958-stereo+input:analog-stereo" prio:5565 (available: yes)
description:"Digital Stereo (IEC958) Output + Analog Stereo Input"
devices: (2)
* device 11: direction:playback name:"iec958-stereo" prio:55 flags:00000015 devices: "iec958:%f"
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
profile 4: name:"output:iec958-stereo" prio:5500 (available: yes)
description:"Digital Stereo (IEC958) Output"
devices: (1)
* device 11: direction:playback name:"iec958-stereo" prio:55 flags:00000015 devices: "iec958:%f"
profile 5: name:"output:analog-surround-21+input:analog-stereo" prio:1365 (available: no)
description:"Analog Surround 2.1 Output + Analog Stereo Input"
devices: (2)
device 6: direction:playback name:"analog-surround-21" prio:13 flags:00000000 devices: "surround21:%f"
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
profile 6: name:"output:analog-surround-41+input:analog-stereo" prio:1365 (available: no)
description:"Analog Surround 4.1 Output + Analog Stereo Input"
devices: (2)
device 8: direction:playback name:"analog-surround-41" prio:13 flags:00000000 devices: "surround41:%f"
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
profile 7: name:"output:analog-surround-51+input:analog-stereo" prio:1365 (available: no)
description:"Analog Surround 5.1 Output + Analog Stereo Input"
devices: (2)
device 10: direction:playback name:"analog-surround-51" prio:13 flags:00000000 devices: "surround51:%f"
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
profile 8: name:"output:analog-surround-21" prio:1300 (available: no)
description:"Analog Surround 2.1 Output"
devices: (1)
device 6: direction:playback name:"analog-surround-21" prio:13 flags:00000000 devices: "surround21:%f"
profile 9: name:"output:analog-surround-41" prio:1300 (available: no)
description:"Analog Surround 4.1 Output"
devices: (1)
device 8: direction:playback name:"analog-surround-41" prio:13 flags:00000000 devices: "surround41:%f"
profile 10: name:"output:analog-surround-51" prio:1300 (available: no)
description:"Analog Surround 5.1 Output"
devices: (1)
device 10: direction:playback name:"analog-surround-51" prio:13 flags:00000000 devices: "surround51:%f"
profile 11: name:"output:analog-surround-40+input:analog-stereo" prio:1265 (available: no)
description:"Analog Surround 4.0 Output + Analog Stereo Input"
devices: (2)
device 7: direction:playback name:"analog-surround-40" prio:12 flags:00000000 devices: "surround40:%f"
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
profile 12: name:"output:analog-surround-50+input:analog-stereo" prio:1265 (available: no)
description:"Analog Surround 5.0 Output + Analog Stereo Input"
devices: (2)
device 9: direction:playback name:"analog-surround-50" prio:12 flags:00000000 devices: "surround50:%f"
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
profile 13: name:"output:analog-surround-40" prio:1200 (available: no)
description:"Analog Surround 4.0 Output"
devices: (1)
device 7: direction:playback name:"analog-surround-40" prio:12 flags:00000000 devices: "surround40:%f"
profile 14: name:"output:analog-surround-50" prio:1200 (available: no)
description:"Analog Surround 5.0 Output"
devices: (1)
device 9: direction:playback name:"analog-surround-50" prio:12 flags:00000000 devices: "surround50:%f"
profile 15: name:"input:analog-stereo" prio:65 (available: no)
description:"Analog Stereo Input"
devices: (1)
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
profile 16: name:"pro-audio" prio:1 (available: unknown)
description:"Pro Audio"
devices: (4)
device 1: direction:playback name:"pro-output-0" prio:0 flags:00000000 devices: "hw:1,0"
device 2: direction:playback name:"pro-output-1" prio:0 flags:00000000 devices: "hw:1,1"
device 3: direction:capture name:"pro-input-0" prio:0 flags:00000000 devices: "hw:1,0"
device 4: direction:capture name:"pro-input-2" prio:0 flags:00000000 devices: "hw:1,2"
* port 0: name:"analog-input-front-mic" direction:capture prio:8500 (available: no)
properties: (4)
port.type = "mic"
port.availability-group = "Legacy 1"
device.icon_name = "audio-input-microphone"
card.profile.port = "0"
profiles: (8)
profile 15: name:"input:analog-stereo" prio:65 (available: no)
profile 1: name:"output:analog-stereo+input:analog-stereo" prio:6565 (available: no)
profile 5: name:"output:analog-surround-21+input:analog-stereo" prio:1365 (available: no)
profile 11: name:"output:analog-surround-40+input:analog-stereo" prio:1265 (available: no)
profile 6: name:"output:analog-surround-41+input:analog-stereo" prio:1365 (available: no)
profile 12: name:"output:analog-surround-50+input:analog-stereo" prio:1265 (available: no)
profile 7: name:"output:analog-surround-51+input:analog-stereo" prio:1365 (available: no)
* profile 3: name:"output:iec958-stereo+input:analog-stereo" prio:5565 (available: yes)
devices: (1)
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
port 1: name:"analog-input-rear-mic" direction:capture prio:8200 (available: no)
properties: (4)
port.type = "mic"
port.availability-group = "Legacy 2"
device.icon_name = "audio-input-microphone"
card.profile.port = "1"
profiles: (8)
profile 15: name:"input:analog-stereo" prio:65 (available: no)
profile 1: name:"output:analog-stereo+input:analog-stereo" prio:6565 (available: no)
profile 5: name:"output:analog-surround-21+input:analog-stereo" prio:1365 (available: no)
profile 11: name:"output:analog-surround-40+input:analog-stereo" prio:1265 (available: no)
profile 6: name:"output:analog-surround-41+input:analog-stereo" prio:1365 (available: no)
profile 12: name:"output:analog-surround-50+input:analog-stereo" prio:1265 (available: no)
profile 7: name:"output:analog-surround-51+input:analog-stereo" prio:1365 (available: no)
* profile 3: name:"output:iec958-stereo+input:analog-stereo" prio:5565 (available: yes)
devices: (1)
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
port 2: name:"analog-input-linein" direction:capture prio:8100 (available: no)
properties: (3)
port.type = "line"
port.availability-group = "Legacy 3"
card.profile.port = "2"
profiles: (8)
profile 15: name:"input:analog-stereo" prio:65 (available: no)
profile 1: name:"output:analog-stereo+input:analog-stereo" prio:6565 (available: no)
profile 5: name:"output:analog-surround-21+input:analog-stereo" prio:1365 (available: no)
profile 11: name:"output:analog-surround-40+input:analog-stereo" prio:1265 (available: no)
profile 6: name:"output:analog-surround-41+input:analog-stereo" prio:1365 (available: no)
profile 12: name:"output:analog-surround-50+input:analog-stereo" prio:1265 (available: no)
profile 7: name:"output:analog-surround-51+input:analog-stereo" prio:1365 (available: no)
* profile 3: name:"output:iec958-stereo+input:analog-stereo" prio:5565 (available: yes)
devices: (1)
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
port 3: name:"analog-output-lineout" direction:playback prio:9000 (available: no)
properties: (3)
port.type = "line"
port.availability-group = "Legacy 4"
card.profile.port = "3"
profiles: (12)
profile 2: name:"output:analog-stereo" prio:6500 (available: no)
profile 1: name:"output:analog-stereo+input:analog-stereo" prio:6565 (available: no)
profile 8: name:"output:analog-surround-21" prio:1300 (available: no)
profile 5: name:"output:analog-surround-21+input:analog-stereo" prio:1365 (available: no)
profile 13: name:"output:analog-surround-40" prio:1200 (available: no)
profile 11: name:"output:analog-surround-40+input:analog-stereo" prio:1265 (available: no)
profile 9: name:"output:analog-surround-41" prio:1300 (available: no)
profile 6: name:"output:analog-surround-41+input:analog-stereo" prio:1365 (available: no)
profile 14: name:"output:analog-surround-50" prio:1200 (available: no)
profile 12: name:"output:analog-surround-50+input:analog-stereo" prio:1265 (available: no)
profile 10: name:"output:analog-surround-51" prio:1300 (available: no)
profile 7: name:"output:analog-surround-51+input:analog-stereo" prio:1365 (available: no)
devices: (6)
device 5: direction:playback name:"analog-stereo" prio:65 flags:00000000 devices: "front:%f"
device 6: direction:playback name:"analog-surround-21" prio:13 flags:00000000 devices: "surround21:%f"
device 7: direction:playback name:"analog-surround-40" prio:12 flags:00000000 devices: "surround40:%f"
device 8: direction:playback name:"analog-surround-41" prio:13 flags:00000000 devices: "surround41:%f"
device 9: direction:playback name:"analog-surround-50" prio:12 flags:00000000 devices: "surround50:%f"
device 10: direction:playback name:"analog-surround-51" prio:13 flags:00000000 devices: "surround51:%f"
port 4: name:"analog-output-headphones" direction:playback prio:9900 (available: no)
properties: (4)
port.type = "headphones"
port.availability-group = "Legacy 5"
device.icon_name = "audio-headphones"
card.profile.port = "4"
profiles: (2)
profile 2: name:"output:analog-stereo" prio:6500 (available: no)
profile 1: name:"output:analog-stereo+input:analog-stereo" prio:6565 (available: no)
devices: (1)
device 5: direction:playback name:"analog-stereo" prio:65 flags:00000000 devices: "front:%f"
* port 5: name:"iec958-stereo-output" direction:playback prio:0 (available: unknown)
properties: (2)
port.type = "spdif"
card.profile.port = "5"
profiles: (2)
profile 4: name:"output:iec958-stereo" prio:5500 (available: yes)
* profile 3: name:"output:iec958-stereo+input:analog-stereo" prio:5565 (available: yes)
devices: (1)
* device 11: direction:playback name:"iec958-stereo" prio:55 flags:00000015 devices: "iec958:%f"
* device 0: direction:capture name:"analog-stereo" prio:65 flags:00000007 devices: "front:%f"
rate:0 channels:2
properties: (17)
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Analog"
alsa.id = "ALCS1200A Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
device.profile.name = "analog-stereo"
device.profile.description = "Analog Stereo"
card.profile.device = "0"
ports: (3)
* port 0: name:"analog-input-front-mic" direction:capture prio:8500 (available: no)
port 1: name:"analog-input-rear-mic" direction:capture prio:8200 (available: no)
port 2: name:"analog-input-linein" direction:capture prio:8100 (available: no)
device 1: direction:playback name:"pro-output-0" prio:0 flags:00000000 devices: "hw:1,0"
rate:48000 channels:6
properties: (18)
alsa.resolution_bits = "32"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Analog"
alsa.id = "ALCS1200A Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
clock.name = "api.alsa.1"
device.profile.name = "pro-output-0"
device.profile.description = "Pro"
card.profile.device = "1"
ports: (0)
device 2: direction:playback name:"pro-output-1" prio:0 flags:00000000 devices: "hw:1,1"
rate:48000 channels:2
properties: (18)
alsa.resolution_bits = "32"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Digital"
alsa.id = "ALCS1200A Digital"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "1"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
clock.name = "api.alsa.1"
device.profile.name = "pro-output-1"
device.profile.description = "Pro 1"
card.profile.device = "2"
ports: (0)
device 3: direction:capture name:"pro-input-0" prio:0 flags:00000000 devices: "hw:1,0"
rate:48000 channels:2
properties: (18)
alsa.resolution_bits = "32"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Analog"
alsa.id = "ALCS1200A Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
clock.name = "api.alsa.1"
device.profile.name = "pro-input-0"
device.profile.description = "Pro"
card.profile.device = "3"
ports: (0)
device 4: direction:capture name:"pro-input-2" prio:0 flags:00000000 devices: "hw:1,2"
rate:48000 channels:2
properties: (18)
alsa.resolution_bits = "32"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Alt Analog"
alsa.id = "ALCS1200A Alt Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "2"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
clock.name = "api.alsa.1"
device.profile.name = "pro-input-2"
device.profile.description = "Pro 2"
card.profile.device = "4"
ports: (0)
device 5: direction:playback name:"analog-stereo" prio:65 flags:00000000 devices: "front:%f"
rate:0 channels:2
properties: (17)
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Analog"
alsa.id = "ALCS1200A Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
device.profile.name = "analog-stereo"
device.profile.description = "Analog Stereo"
card.profile.device = "5"
ports: (2)
port 3: name:"analog-output-lineout" direction:playback prio:9000 (available: no)
port 4: name:"analog-output-headphones" direction:playback prio:9900 (available: no)
device 6: direction:playback name:"analog-surround-21" prio:13 flags:00000000 devices: "surround21:%f"
rate:0 channels:3
properties: (17)
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Analog"
alsa.id = "ALCS1200A Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
device.profile.name = "analog-surround-21"
device.profile.description = "Analog Surround 2.1"
card.profile.device = "6"
ports: (1)
port 3: name:"analog-output-lineout" direction:playback prio:9000 (available: no)
device 7: direction:playback name:"analog-surround-40" prio:12 flags:00000000 devices: "surround40:%f"
rate:0 channels:4
properties: (17)
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Analog"
alsa.id = "ALCS1200A Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
device.profile.name = "analog-surround-40"
device.profile.description = "Analog Surround 4.0"
card.profile.device = "7"
ports: (1)
port 3: name:"analog-output-lineout" direction:playback prio:9000 (available: no)
device 8: direction:playback name:"analog-surround-41" prio:13 flags:00000000 devices: "surround41:%f"
rate:0 channels:5
properties: (17)
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Analog"
alsa.id = "ALCS1200A Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
device.profile.name = "analog-surround-41"
device.profile.description = "Analog Surround 4.1"
card.profile.device = "8"
ports: (1)
port 3: name:"analog-output-lineout" direction:playback prio:9000 (available: no)
device 9: direction:playback name:"analog-surround-50" prio:12 flags:00000000 devices: "surround50:%f"
rate:0 channels:5
properties: (17)
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Analog"
alsa.id = "ALCS1200A Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
device.profile.name = "analog-surround-50"
device.profile.description = "Analog Surround 5.0"
card.profile.device = "9"
ports: (1)
port 3: name:"analog-output-lineout" direction:playback prio:9000 (available: no)
device 10: direction:playback name:"analog-surround-51" prio:13 flags:00000000 devices: "surround51:%f"
rate:0 channels:6
properties: (17)
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Analog"
alsa.id = "ALCS1200A Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
device.profile.name = "analog-surround-51"
device.profile.description = "Analog Surround 5.1"
card.profile.device = "10"
ports: (1)
port 3: name:"analog-output-lineout" direction:playback prio:9000 (available: no)
* device 11: direction:playback name:"iec958-stereo" prio:55 flags:00000015 devices: "iec958:%f"
rate:0 channels:2
properties: (17)
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALCS1200A Digital"
alsa.id = "ALCS1200A Digital"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "1"
alsa.card = "1"
alsa.card_name = "HD-Audio Generic"
alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 138"
alsa.driver_name = "snd_hda_intel"
device.profile.name = "iec958-stereo"
device.profile.description = "Digital Stereo (IEC958)"
card.profile.device = "11"
ports: (1)
* port 5: name:"iec958-stereo-output" direction:playback prio:0 (available: unknown)

This is what is missing the AC3:

Default Sink: alsa_output.pci-0000_0c_00.4.iec958-stereo
Default Source: alsa_output.pci-0000_0c_00.4.iec958-stereo.monitor

What I believe is I don’t have the proper alsa-card-profile in Nix. I am able to locate all the alsa .conf files in Arch, including some that have “ac3” in them, but I think in Nix all those profiles are built-in pipewire or wireplumber or something.

Maybe I need to patch one of those packages (or alsa itself, I don’t know) in my config.nix.

But that’s my problem, I have no idea what code to use, where to patch it (IF a patch is required) and how to patch it.

I have installed all the Codec packages I could find in Nix repo that match the ones I got in Arch:

Audio/Video codecs in Nix
	ffmpegthumbnailer
	libdvdcss
	libdv
	libdvdread
	gst_all_1.gstreamer
	gst_all_1.gst-vaapi
	gst_all_1.gst-plugins-ugly
	gst_all_1.gst-plugins-good
	gst_all_1.gst-plugins-bad
	gst_all_1.gst-plugins-base
	apulse
	alsa-plugins
	alsa-lib
	alsa-firmware
	alsa-plugins-wrapper
	alsa-topology-conf
	alsa-ucm-conf
	faac
	ffmpeg_6-full
	ffmpeg_4-full
	ffmpeg
	pavucontrol
	libsForQt5.ffmpegthumbs
	gst_all_1.gst-libav
	flac
	faad2
	libaom
	libavif
	libva
	libva1
	libva-utils
	libavc1394
	libbluray
	libde265
	libsForQt5.phonon
	libsForQt5.phonon-backend-gstreamer
	libsForQt5.phonon-backend-vlc
	vaapiVdpau
	aribb25
	a52dec
	brotli
	l-smash
	lame
	fdk-aac-encoder
	libiec61883
	libmad
	libmpeg2
	libtheora
	apulse
	libsForQt5.pulseaudio-qt
	pulseaudioFull
	libpulseaudio
	libsForQt5.kpipewire
	rtkit
	svt-av1
	v4l-utils
	x264
	x265
	xvidcore
	zita-resampler
	zita-alsa-pcmi

I have kept many URLs I tried to understand:

Web sites visited

PulseAudio - NixOS Wiki
PipeWire - NixOS Wiki
WirePlumber - ArchWiki
Wireplumber completely broke audio and video playback · Issue #163066 · NixOS/nixpkgs · GitHub
pulse/alsa: No output devices detected since last update · Issue #128925 · NixOS/nixpkgs · GitHub
Asus UX390 add a pulseaudio configuration - #4 by hmenke
Pipewire does not recognize my 4.1 sound system (#2023) · Issues · PipeWire / pipewire · GitLab
No input devices available · Issue #80960 · NixOS/nixpkgs · GitHub
PipeWire status tracking issue · Issue #102547 · NixOS/nixpkgs · GitHub
https://pipewire.pages.freedesktop.org/wireplumber/configuration/alsa.html
FAQ · Wiki · PipeWire / pipewire · GitLab

I usually never run out of ideas when it comes to troubleshooting and testing stuff, but on this one I have…

Any ideas what else I can try?

Thanks!!

3 Likes

I sadly don’t have anything to contribute to this particular issue, but I have to appreciate how well written this post is :grin:

2 Likes

Hi, sorry to necrobump, but seeing that this is a hard problem and a post that got 1.4k views, I’d like to share how I fixed this problem on my machine.

Cause

There were two root causes.

  1. The a52 plugin is not enabled by default. To fix this, it suffices to symlink its config file to the alsa conf.d dir in /etc.
  2. The alsa-lib package does not find .so files from alsa-plugins.[1]. To fix this, we have to tell alsa where to look for it.

The combination of these two makes it so that the a52 plugin is never ran (due to cause #1), and if a user supplied the relevant config locally (e. g. via ~/.asoundrc), it would fail to run due to (cause #2).

Test for Cause

Aforementioned failure would be evidenced by the speakertest command for a52[2] showing an error akin this:

# select CARD and DEVICE of the digital IEC958 output found in `aplay -l`
$ CARD=1
$ DEVICE=4
$ speaker-test -d -b 2000000 -c 6 -D"plug:{SLAVE=\"a52:${CARD},'hw:${CARD},${DEVICE}'\"}"
Playback device is plug:{SLAVE="a52:1,'hw:1,1'"}
Stream parameters are 48000Hz, S16_LE, 6 channels
Using 16 octaves of pink noise
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_a52.so (/nix/store/p4mjdx6l2q4ff3ssjwh989rlw4xwljb7-alsa-lib-1.2.12/lib/alsa-lib/libasound_module_pcm_a52.so: cannot open shared object file: No such file or directory)
Playback open error: -6,No such device or address

Fix

To fix this, a short snippet in the NixOS configuration suffices:

environment.etc = {
  # fix for cause #1
  "alsa/conf.d/60-a52-encoder.conf".source =
    pkgs.alsa-plugins + "/etc/alsa/conf.d/60-a52-encoder.conf";

  # fix for cause #2
  "alsa/conf.d/59-a52-lib.conf".text = ''
    pcm_type.a52 {
      lib "${pkgs.alsa-plugins}/lib/alsa-lib/libasound_module_pcm_a52.so"
    }
  '';
};

After making this addition, the a52 plugin works both with pulseaudio and pipewire. However, to be in effect, two additional steps were required:

  1. Restart the pipewire/pulseaudio user session daemons so that they observe the changed alsa config. For example systemctl --user restart pipewire\*.service pulseaudio\*.service.
  2. Open pauvcontrol/Volumecontrol, and change the configuration of your IEC958 capable soundcard to “Digital Surround 5.1 (IEC958/AC3) Output”.

I hope that this helps anyone to not struggle as long as I did to simply enjoy watching a movie with surround sound from their NixOS box using S/PDIF or TOSLINK or IEC958.


  1. ↩︎

  2. ↩︎

2 Likes

Hey thank you so much for this! Finally an idea on what to try.
I’m not sure when I will be able to, but I have taken good notes of your explanation.

Very appreciated!!

1 Like