luisbocanegra / linux-guide-split-audio-ports

Split jack(headphones)/speakers outputs into individual sinks on Linux to allow simultaneous playback (listen to different audio streams on each port)
39 stars 4 forks source link

Pipewire controls the wrong alsa volume on Line Out #20

Open MINERODO10 opened 2 days ago

MINERODO10 commented 2 days ago

When i try to change the volume on the headphone out sink it works just fine but on the Line Out sink instead of using the correct "Line Out" volume slider thats on alsamixer it controls "PCM" image Not sure why it does this and havent found anything on how to change it to control the right slider maybe set override-map.1 = ... or override-map.2 = ... in a element in analog-output-speaker-split.conf but by its description in analog-output-conf.common it might not actually help

To actually control volume on the line out i have to do it in alsamixer that way it just works fine

FastFetch output

OS: EndeavourOS x86_64
Host: HP ProDesk 400 G3 SFF
Kernel: Linux 6.11.1-zen1-1-zen
Uptime: 1 hour, 6 mins
Packages: 1591 (pacman), 26 (flatpak-system), 11 (flatpak-user)
Shell: bash 5.2.37
Display (SAC 24"): 1920x1080 @ 60 Hz in 24″ [External] *
Display (E1940): 1360x768 @ 60 Hz in 19″ [External]
DE: GNOME 47.0
WM: Mutter (Wayland)
WM Theme: Adwaita
Theme: Adwaita [GTK2/3/4]
Icons: Adwaita [GTK2/3/4]
Font: Noto Sans (10pt) [GTK2/3/4]
Cursor: miku-cursor-linux (32px)
Terminal: GNOME Console 47.1
Terminal Font: Source Code Pro (10pt)
CPU: Intel(R) Core(TM) i3-6100 (4) @ 3.70 GHz
GPU: Intel HD Graphics 530 @ 1.05 GHz [Integrated]
Memory: 3.50 GiB / 15.05 GiB (23%)
Swap: 0 B / 16.56 GiB (0%)
Disk (/): 486.44 GiB / 898.53 GiB (54%) - ext4
Local IP (enp1s0): 192.168.1.80/24
Locale: en_US.UTF-8

My config files

/etc/alsa-card-profile/mixer/profile-sets/split-ports-profile.conf

; This will let alsa generate automatic profiles (e.g internal speaker + microphone)
[General]
auto-profiles = yes

; device-strings describes the ALSA device string(s) that PulseAudio uses to open the device, where "%f" specifies the card number (should always be present in the string).

; This is the mapping for the internal speaker
; If needed, change the 0 in "hw:%f,0" to your sub device location
; You can change the description for this and other mappings if you want
; in paths output put the name of the previously created custom mixer path
[Mapping analog-stereo-lineout]
description = Line Out
device-strings = hw:%f,0
paths-output = analog-output-speaker-split
channel-map = left,right
direction = output

; This is the mapping for the jack output (headphones)
; If needed, change the 2 in "hw:%f,2" to your sub device location
; in paths output put the name of the from card details
[Mapping analog-stereo-headphones]
description = Headphones
device-strings = hw:%f,2
paths-output = analog-output-headphones
channel-map = left,right
direction = output

; This is the mapping that will handle internal and external microphones, as you could see in `cat /proc/asound/pcm`, the card also had a capture port
; in the 0,0 sub device location so let's add it here too (change the 0 in "hw:%f,0" to your sub device location that has the capture port)
; All the paths-input names here came from the default.conf profile set and you may have to adapt it if your input port name is not included

[Mapping analog-stereo-input]
description = Microphone
device-strings = hw:%f,0
channel-map = left,right
paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
direction = input

; Broken in parts the profile name means to join
; The name of the Mapping containing the analog-output-headphones (output:analog-stereo-headphones)
; The name of the Mapping containing the analog-output-speaker (output:analog-stereo-speaker)
; The name of the Mapping containing the analog-stereo-input (input:analog-stereo-input)

; in output-mappings put the name of the output mappings
; input-mappings put the name of the input mappings

; NOTE: Not to be confused width the paths-output/paths-input inside the mapping, we're not using those directly

; This is the profile that will have the internal speakers + jack output + all microphones
; in paths output put the name of the from card details
[Profile output:analog-stereo-headphones+output:analog-stereo-speaker+input:analog-stereo-input]
description = Analog Stereo Duplex
output-mappings = analog-stereo-headphones analog-stereo-lineout
input-mappings = analog-stereo-input
priority = 80

; This profile will have the internal speakers + jack output, but not microphones
[Profile output:analog-stereo-headphones+output:analog-stereo-speaker]
description = Analog Stereo Outputs Only
output-mappings = analog-stereo-headphones analog-stereo-lineout
priority = 70

/etc/alsa-card-profile/mixer/paths/analog-output-speaker-split.conf

# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

[General]
priority = 90
description-key = analog-output-lineout

[Jack Line Out]
required-any = any

[Jack Line Out Phantom]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Front Line Out]
required-any = any

[Jack Front Line Out Phantom]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Headphone]
state.plugged = unknown
state.unplugged = unknown

[Jack Rear Line Out]
required-any = any

[Jack Rear Line Out Phantom]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Line Out Front]
required-any = any

[Jack Line Out Front Phantom]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Line Out CLFE]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Line Out CLFE Phantom]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Line Out Surround]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Line Out Surround Phantom]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Line Out Side]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Line Out Side Phantom]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Jack Dock Line Out]
required-any = any

[Jack Dock Line Out Phantom]
state.plugged = unknown
state.unplugged = unknown
required-any = any

[Element Hardware Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Master]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Speaker+LO]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
required-any = any

[Element Headphone+LO]
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right
required-any = any

[Element Master Mono]
switch = off
volume = off

[Element Line HP Swap]
switch = off
required-any = any

; This profile path is intended to control line out, let's mute headphones
; else there will be a spike when plugging in headphones
[Element Headphone]
; switch = off
; volume = off

[Element Headphone,1]
switch = off
volume = off

[Element Headphone2]
switch = off
volume = off

[Element Speaker]
switch = off
volume = off

[Element Desktop Speaker]
switch = off
volume = off

[Element Front]
switch = mute
volume = merge
override-map.1 = all-front
override-map.2 = front-left,front-right

[Element Rear]
switch = mute
volume = merge
override-map.1 = all-rear
override-map.2 = rear-left,rear-right

[Element Surround]
switch = mute
volume = merge
override-map.1 = all-rear
override-map.2 = rear-left,rear-right

[Element Side]
switch = mute
volume = merge
override-map.1 = all-side
override-map.2 = side-left,side-right

[Element Center]
switch = mute
volume = merge
override-map.1 = all-center
override-map.2 = all-center,all-center

[Element LFE]
switch = mute
volume = merge
override-map.1 = lfe
override-map.2 = lfe,lfe

[Element CLFE]
switch = mute
volume = merge
override-map.1 = all-center
override-map.2 = all-center,lfe

[Element Center/LFE]
switch = mute
volume = merge
override-map.1 = all-center
override-map.2 = all-center,lfe

[Element Bass Speaker]
switch = off
volume = off

[Element Speaker Front]
switch = off
volume = off

[Element Speaker Surround]
switch = off
volume = off

[Element Speaker Side]
switch = off
volume = off

[Element Speaker CLFE]
switch = off
volume = off

.include analog-output.conf.common

And other info

[minerodo@Pyra ~]$ cat /proc/asound/card*/codec#* | grep -E 'Codec|Vendor Id|Subsystem Id|Address'
Codec: Realtek ALC221
Address: 0
Vendor Id: 0x10ec0221
Subsystem Id: 0x103c8062
Codec: Intel Skylake HDMI
Address: 2
Vendor Id: 0x80862809
Subsystem Id: 0x80860101
[minerodo@Pyra ~]$ pactl list cards
Card #49
    Name: alsa_card.pci-0000_00_1f.3
    Driver: alsa
    Owner Module: n/a
    Properties:
        api.acp.auto-port = "false"
        api.alsa.card = "0"
        api.alsa.card.longname = "HDA Intel PCH at 0xe1124000 irq 130"
        api.alsa.card.name = "HDA Intel PCH"
        api.alsa.path = "hw:0"
        api.alsa.use-acp = "true"
        api.dbus.ReserveDevice1 = "Audio0"
        api.dbus.ReserveDevice1.Priority = "-20"
        device.api = "alsa"
        device.bus = "pci"
        device.bus_path = "pci-0000:00:1f.3"
        device.description = "Built-in Audio"
        device.enum.api = "udev"
        device.form_factor = "internal"
        device.icon_name = "audio-card-analog-pci"
        device.name = "alsa_card.pci-0000_00_1f.3"
        device.nick = "HDA Intel PCH"
        device.plugged.usec = "18910749"
        device.product.id = "0xa170"
        device.product.name = "100 Series/C230 Series Chipset Family HD Audio Controller"
        device.profile-set = "/etc/alsa-card-profile/mixer/profile-sets/split-ports-profile.conf"
        device.subsystem = "sound"
        sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
        device.vendor.id = "0x8086"
        device.vendor.name = "Intel Corporation"
        media.class = "Audio/Device"
        factory.id = "15"
        client.id = "47"
        object.id = "49"
        object.serial = "49"
        object.path = "alsa:acp:PCH"
        alsa.card = "0"
        alsa.card_name = "HDA Intel PCH"
        alsa.long_card_name = "HDA Intel PCH at 0xe1124000 irq 130"
        alsa.driver_name = "snd_hda_intel"
        alsa.mixer_name = "Realtek ALC221"
        alsa.components = "HDA:10ec0221,103c8062,00100103 HDA:80862809,80860101,00100000"
        alsa.id = "PCH"
        device.string = "0"
    Profiles:
        off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
        output:analog-stereo-lineout+input:analog-stereo-input: Line Out Output + Microphone Input (sinks: 1, sources: 1, priority: 5050, available: yes)
        output:analog-stereo-headphones+input:analog-stereo-input: Headphones Output + Microphone Input (sinks: 1, sources: 1, priority: 5050, available: yes)
        output:analog-stereo-lineout: Line Out Output (sinks: 1, sources: 0, priority: 5000, available: yes)
        output:analog-stereo-headphones: Headphones Output (sinks: 1, sources: 0, priority: 5000, available: yes)
        output:analog-stereo-headphones+output:analog-stereo-speaker+input:analog-stereo-input: Analog Stereo Duplex (sinks: 2, sources: 1, priority: 80, available: yes)
        output:analog-stereo-headphones+output:analog-stereo-speaker: Analog Stereo Outputs Only (sinks: 2, sources: 0, priority: 70, available: yes)
        input:analog-stereo-input: Microphone Input (sinks: 0, sources: 1, priority: 50, available: no)
        pro-audio: Pro Audio (sinks: 5, sources: 2, priority: 1, available: yes)
    Active Profile: output:analog-stereo-headphones+output:analog-stereo-speaker+input:analog-stereo-input
    Ports:
        analog-output-headphones: Headphones (type: Headphones, priority: 9900, latency offset: 0 usec, availability group: Legacy 3, available)
            Properties:
                port.type = "headphones"
                port.availability-group = "Legacy 3"
                device.icon_name = "audio-headphones"
                card.profile.port = "0"
            Part of profile(s): output:analog-stereo-headphones+output:analog-stereo-speaker+input:analog-stereo-input, output:analog-stereo-headphones+output:analog-stereo-speaker, output:analog-stereo-headphones, output:analog-stereo-headphones+input:analog-stereo-input
        analog-output-speaker-split: Line Out (type: Line, priority: 9000, latency offset: 0 usec, availability group: Legacy 4, available)
            Properties:
                port.type = "line"
                port.availability-group = "Legacy 4"
                card.profile.port = "1"
            Part of profile(s): output:analog-stereo-headphones+output:analog-stereo-speaker+input:analog-stereo-input, output:analog-stereo-headphones+output:analog-stereo-speaker, output:analog-stereo-lineout, output:analog-stereo-lineout+input:analog-stereo-input
        analog-input-mic: Microphone (type: Mic, priority: 8700, latency offset: 0 usec, availability group: Legacy 1, not available)
            Properties:
                port.type = "mic"
                port.availability-group = "Legacy 1"
                device.icon_name = "audio-input-microphone"
                card.profile.port = "2"
            Part of profile(s): output:analog-stereo-headphones+output:analog-stereo-speaker+input:analog-stereo-input, input:analog-stereo-input, output:analog-stereo-lineout+input:analog-stereo-input, output:analog-stereo-headphones+input:analog-stereo-input
        analog-input-linein: Line In (type: Line, priority: 8100, latency offset: 0 usec, availability group: Legacy 2, not available)
            Properties:
                port.type = "line"
                port.availability-group = "Legacy 2"
                card.profile.port = "3"
            Part of profile(s): output:analog-stereo-headphones+output:analog-stereo-speaker+input:analog-stereo-input, input:analog-stereo-input, output:analog-stereo-lineout+input:analog-stereo-input, output:analog-stereo-headphones+input:analog-stereo-input

Sinks before Changes

[minerodo@Pyra ~]$ pactl list sinks
Sink #53
    State: RUNNING
    Name: alsa_output.pci-0000_00_1f.3.analog-stereo
    Description: Built-in Audio Analog Stereo
    Driver: PipeWire
    Sample Specification: s32le 2ch 48000Hz
    Channel Map: front-left,front-right
    Owner Module: 4294967295
    Mute: no
    Volume: front-left: 11796 /  18% / -44,68 dB,   front-right: 11796 /  18% / -44,68 dB
            balance 0,00
    Base Volume: 65536 / 100% / 0,00 dB
    Monitor Source: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
    Latency: 0 usec, configured 0 usec
    Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
    Properties:
        alsa.card = "0"
        alsa.card_name = "HDA Intel PCH"
        alsa.class = "generic"
        alsa.components = "HDA:10ec0221,103c8062,00100103 HDA:80862809,80860101,00100000"
        alsa.device = "0"
        alsa.driver_name = "snd_hda_intel"
        alsa.id = "PCH"
        alsa.long_card_name = "HDA Intel PCH at 0xe1124000 irq 130"
        alsa.mixer_name = "Realtek ALC221"
        alsa.name = "ALC221 Analog"
        alsa.resolution_bits = "16"
        alsa.subclass = "generic-mix"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.sync.id = "00000000:00000000:00000000:00000000"
        api.alsa.card.longname = "HDA Intel PCH at 0xe1124000 irq 130"
        api.alsa.card.name = "HDA Intel PCH"
        api.alsa.path = "front:0"
        api.alsa.pcm.card = "0"
        api.alsa.pcm.stream = "playback"
        audio.channels = "2"
        audio.position = "FL,FR"
        card.profile.device = "7"
        device.api = "alsa"
        device.class = "sound"
        device.id = "49"
        device.profile.description = "Analog Stereo"
        device.profile.name = "analog-stereo"
        device.routes = "2"
        factory.name = "api.alsa.pcm.sink"
        media.class = "Audio/Sink"
        device.description = "Built-in Audio"
        node.name = "alsa_output.pci-0000_00_1f.3.analog-stereo"
        node.nick = "ALC221 Analog"
        node.pause-on-idle = "false"
        object.path = "alsa:acp:PCH:7:playback"
        port.group = "playback"
        priority.driver = "1009"
        priority.session = "1009"
        factory.id = "19"
        clock.quantum-limit = "8192"
        client.id = "48"
        node.driver = "true"
        node.loop.name = "data-loop.0"
        library.name = "audioconvert/libspa-audioconvert"
        object.id = "53"
        object.serial = "53"
        node.max-latency = "16384/48000"
        api.alsa.period-size = "1024"
        api.alsa.period-num = "32"
        api.alsa.headroom = "0"
        api.acp.auto-port = "false"
        api.alsa.card = "0"
        api.alsa.use-acp = "true"
        api.dbus.ReserveDevice1 = "Audio0"
        api.dbus.ReserveDevice1.Priority = "-20"
        device.bus = "pci"
        device.bus_path = "pci-0000:00:1f.3"
        device.enum.api = "udev"
        device.form_factor = "internal"
        device.icon_name = "audio-card-analog-pci"
        device.name = "alsa_card.pci-0000_00_1f.3"
        device.nick = "HDA Intel PCH"
        device.plugged.usec = "63401992"
        device.product.id = "0xa170"
        device.product.name = "100 Series/C230 Series Chipset Family HD Audio Controller"
        device.subsystem = "sound"
        sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
        device.vendor.id = "0x8086"
        device.vendor.name = "Intel Corporation"
        device.string = "0"
    Ports:
        analog-output-lineout: Line Out (type: Line, priority: 9000, availability group: Legacy 3, available)
        analog-output-headphones: Headphones (type: Headphones, priority: 9900, availability group: Legacy 4, available)
    Active Port: analog-output-headphones
    Formats:
        pcm

Sinks after changes

Sink #212
    State: SUSPENDED
    Name: alsa_output.pci-0000_00_1f.3.analog-stereo-headphones
    Description: Built-in Audio Headphones
    Driver: PipeWire
    Sample Specification: s32le 2ch 48000Hz
    Channel Map: front-left,front-right
    Owner Module: 4294967295
    Mute: no
    Volume: front-left: 16462 /  25% / -36,00 dB,   front-right: 16462 /  25% / -36,00 dB
            balance 0,00
    Base Volume: 65536 / 100% / 0,00 dB
    Monitor Source: alsa_output.pci-0000_00_1f.3.analog-stereo-headphones.monitor
    Latency: 0 usec, configured 0 usec
    Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
    Properties:
        alsa.card = "0"
        alsa.card_name = "HDA Intel PCH"
        alsa.class = "generic"
        alsa.components = "HDA:10ec0221,103c8062,00100103 HDA:80862809,80860101,00100000"
        alsa.device = "2"
        alsa.driver_name = "snd_hda_intel"
        alsa.id = "PCH"
        alsa.long_card_name = "HDA Intel PCH at 0xe1124000 irq 130"
        alsa.mixer_name = "Realtek ALC221"
        alsa.name = "ALC221 Alt Analog"
        alsa.resolution_bits = "16"
        alsa.subclass = "generic-mix"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.sync.id = "00000000:00000000:00000000:00000000"
        api.alsa.card.longname = "HDA Intel PCH at 0xe1124000 irq 130"
        api.alsa.card.name = "HDA Intel PCH"
        api.alsa.path = "hw:0,2"
        api.alsa.pcm.card = "0"
        api.alsa.pcm.stream = "playback"
        audio.channels = "2"
        audio.position = "FL,FR"
        card.profile.device = "0"
        device.api = "alsa"
        device.class = "sound"
        device.id = "49"
        device.profile.description = "Headphones"
        device.profile.name = "analog-stereo-headphones"
        device.routes = "1"
        factory.name = "api.alsa.pcm.sink"
        media.class = "Audio/Sink"
        device.description = "Built-in Audio"
        node.name = "alsa_output.pci-0000_00_1f.3.analog-stereo-headphones"
        node.nick = "ALC221 Alt Analog"
        node.pause-on-idle = "false"
        object.path = "alsa:acp:PCH:0:playback"
        port.group = "playback"
        priority.driver = "721"
        priority.session = "721"
        factory.id = "19"
        clock.quantum-limit = "8192"
        client.id = "47"
        node.driver = "true"
        node.loop.name = "data-loop.0"
        library.name = "audioconvert/libspa-audioconvert"
        object.id = "51"
        object.serial = "212"
        api.acp.auto-port = "false"
        api.alsa.card = "0"
        api.alsa.use-acp = "true"
        api.dbus.ReserveDevice1 = "Audio0"
        api.dbus.ReserveDevice1.Priority = "-20"
        device.bus = "pci"
        device.bus_path = "pci-0000:00:1f.3"
        device.enum.api = "udev"
        device.form_factor = "internal"
        device.icon_name = "audio-card-analog-pci"
        device.name = "alsa_card.pci-0000_00_1f.3"
        device.nick = "HDA Intel PCH"
        device.plugged.usec = "18910749"
        device.product.id = "0xa170"
        device.product.name = "100 Series/C230 Series Chipset Family HD Audio Controller"
        device.profile-set = "/etc/alsa-card-profile/mixer/profile-sets/split-ports-profile.conf"
        device.subsystem = "sound"
        sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
        device.vendor.id = "0x8086"
        device.vendor.name = "Intel Corporation"
        device.string = "0"
    Ports:
        analog-output-headphones: Headphones (type: Headphones, priority: 9900, availability group: Legacy 3, available)
    Active Port: analog-output-headphones
    Formats:
        pcm

Sink #213
    State: RUNNING
    Name: alsa_output.pci-0000_00_1f.3.analog-stereo-lineout
    Description: Built-in Audio Line Out
    Driver: PipeWire
    Sample Specification: s32le 2ch 48000Hz
    Channel Map: front-left,front-right
    Owner Module: 4294967295
    Mute: no
    Volume: front-left: 26216 /  40% / -23,87 dB,   front-right: 26216 /  40% / -23,87 dB
            balance 0,00
    Base Volume: 65536 / 100% / 0,00 dB
    Monitor Source: alsa_output.pci-0000_00_1f.3.analog-stereo-lineout.monitor
    Latency: 0 usec, configured 0 usec
    Flags: HARDWARE HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
    Properties:
        alsa.card = "0"
        alsa.card_name = "HDA Intel PCH"
        alsa.class = "generic"
        alsa.components = "HDA:10ec0221,103c8062,00100103 HDA:80862809,80860101,00100000"
        alsa.device = "0"
        alsa.driver_name = "snd_hda_intel"
        alsa.id = "PCH"
        alsa.long_card_name = "HDA Intel PCH at 0xe1124000 irq 130"
        alsa.mixer_name = "Realtek ALC221"
        alsa.name = "ALC221 Analog"
        alsa.resolution_bits = "16"
        alsa.subclass = "generic-mix"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.sync.id = "00000000:00000000:00000000:00000000"
        api.alsa.card.longname = "HDA Intel PCH at 0xe1124000 irq 130"
        api.alsa.card.name = "HDA Intel PCH"
        api.alsa.path = "hw:0,0"
        api.alsa.pcm.card = "0"
        api.alsa.pcm.stream = "playback"
        audio.channels = "2"
        audio.position = "FL,FR"
        card.profile.device = "1"
        device.api = "alsa"
        device.class = "sound"
        device.id = "49"
        device.profile.description = "Line Out"
        device.profile.name = "analog-stereo-lineout"
        device.routes = "1"
        factory.name = "api.alsa.pcm.sink"
        media.class = "Audio/Sink"
        device.description = "Built-in Audio"
        node.name = "alsa_output.pci-0000_00_1f.3.analog-stereo-lineout"
        node.nick = "ALC221 Analog"
        node.pause-on-idle = "false"
        object.path = "alsa:acp:PCH:1:playback"
        port.group = "playback"
        priority.driver = "1009"
        priority.session = "1009"
        factory.id = "19"
        clock.quantum-limit = "8192"
        client.id = "47"
        node.driver = "true"
        node.loop.name = "data-loop.0"
        library.name = "audioconvert/libspa-audioconvert"
        object.id = "63"
        object.serial = "213"
        node.max-latency = "16384/48000"
        api.alsa.period-size = "1024"
        api.alsa.period-num = "32"
        api.alsa.headroom = "0"
        api.acp.auto-port = "false"
        api.alsa.card = "0"
        api.alsa.use-acp = "true"
        api.dbus.ReserveDevice1 = "Audio0"
        api.dbus.ReserveDevice1.Priority = "-20"
        device.bus = "pci"
        device.bus_path = "pci-0000:00:1f.3"
        device.enum.api = "udev"
        device.form_factor = "internal"
        device.icon_name = "audio-card-analog-pci"
        device.name = "alsa_card.pci-0000_00_1f.3"
        device.nick = "HDA Intel PCH"
        device.plugged.usec = "18910749"
        device.product.id = "0xa170"
        device.product.name = "100 Series/C230 Series Chipset Family HD Audio Controller"
        device.profile-set = "/etc/alsa-card-profile/mixer/profile-sets/split-ports-profile.conf"
        device.subsystem = "sound"
        sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
        device.vendor.id = "0x8086"
        device.vendor.name = "Intel Corporation"
        device.string = "0"
    Ports:
        analog-output-speaker-split: Line Out (type: Line, priority: 9000, availability group: Legacy 4, available)
    Active Port: analog-output-speaker-split
    Formats:
        pcm
[minerodo@Pyra ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC221 Analog [ALC221 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 2: ALC221 Alt Analog [ALC221 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
luisbocanegra commented 2 days ago

On my device it also changes the pcm but only on the lowest values, this happens with both speakers/headphones slider.

What happens if you play around by setting different values for the PCM?

Add the following and comment out the include of .common file at the end of the mixer path (/etc/alsa-card-profile/mixer/paths/analog-output-speaker-split.conf)

[Element PCM]
switch = mute
volume = zero
;.include analog-output.conf.common

On my device at least, the above makes the PCM stay at a fixed 100 (0.00 dB) if it works you may have to do the same with the mixer path for the headhones by copying the original to /etc too.

Please lower your volumes to zero and do small increments from there until you hear something, you don't want to accidentally play at the highest volume and risk damaging your ears/hardware

If that doesn't work, this looks like a good place to start investigating https://askubuntu.com/questions/15069/how-do-i-change-the-way-ubuntu-adjusts-my-volume-mixer-levels

luisbocanegra commented 2 days ago

Also, does changing the volume to the maximum ever changes the Line out volume or it never touches it?

In the linked askubuntu question they describe no volume change or jumps at some percentages.

Is yours always static?

In your screenshot, what does Line do?

MINERODO10 commented 2 days ago

This is the behavior of both outputs, sinks, ports, thingamajigs, or whatever you want to call it with a 1khz tone

The front panel headphone out works just fine appart from PCM going up and down in what might or might not some kind of pattern on each volume change

The rear line out however only modifies the PCM slider so i have to modify the correct Line Out slider miself

Behavior is the same whether both ports are connected or only one of them is

https://github.com/user-attachments/assets/940a5540-7323-4b6d-aa6f-aa6532c205af

(Audio was recorded externally on a Pentium 4 running Windows XP so sorry for the (not so) low quality audio though the strange delay at the end was (clearly) on my pc and NOT on the recording machine)

MINERODO10 commented 2 days ago

Now that i modify analog-output-speaker-split.conf with

[Element PCM]
switch = mute
volume = zero
;.include analog-output.conf.common

changing volume on pipewire on the Line Out sink does nothing both to Line Out or PCM in alsa and the Headphones sink (of course) keeps its "pattern" on PCM while changing volume

luisbocanegra commented 1 day ago

This is extremely similar to https://github.com/luisbocanegra/linux-guide-split-audio-ports/issues/19 maybe is the same problem under the hood.

I found this [Solved] PulseAudio does not use hardware volume control, it seems you need to tell to pipewire which control to use https://docs.pipewire.org/page_man_pipewire-pulse-modules_7.html please try that.

luisbocanegra commented 1 day ago

On my device it also changes the pcm but only on the lowest values, this happens with both speakers/headphones slider.

What happens if you play around by setting different values for the PCM?

Add the following and comment out the include of .common file at the end of the mixer path (/etc/alsa-card-profile/mixer/paths/analog-output-speaker-split.conf)

[Element PCM]
switch = mute
volume = zero
;.include analog-output.conf.common

On my device at least, the above makes the PCM stay at a fixed 100 (0.00 dB) if it works you may have to do the same with the mixer path for the headhones by copying the original to /etc too.

Please lower your volumes to zero and do small increments from there until you hear something, you don't want to accidentally play at the highest volume and risk damaging your ears/hardware

If that doesn't work, this looks like a good place to start investigating askubuntu.com/questions/15069/how-do-i-change-the-way-ubuntu-adjusts-my-volume-mixer-levels

Before doing that revert this

MINERODO10 commented 1 day ago

Sadly running pactl load-module module-alsa-sink will crash (or cause a memory leak, not sure) in pipewire and on some occasions it crashed gnome(mutter?) too

luisbocanegra commented 1 day ago

Hmm, just tried changing the sink name and the same happened here. Restarting pipewire after that takes one and half minute.

It seems that the way to configure that now is through wireplumber https://pipewire.pages.freedesktop.org/wireplumber/daemon/configuration/alsa.html

luisbocanegra commented 1 day ago

https://pipewire.pages.freedesktop.org/wireplumber/daemon/configuration/alsa.html

Maybe

api.alsa.soft-mixer

Setting this option to true will disable the hardware mixer for volume control and mute. All volume handling will then use software volume and mute, leaving the hardware mixer untouched. The hardware mixer will still be used to mute unused audio paths in the device.

Type:

    boolean

or

api.alsa.ignore-dB

Setting this option to true will ignore the decibel setting configured by the driver. Use this when the driver reports wrong settings.

Type:

    boolean

eg:

# /home/$USER/.config/wireplumber/wireplumber.conf.d/test.conf
monitor.alsa.rules = [
    {
        matches = [
            {
                node.name = "~alsa_output.*stereo-lineout"
            }
        ]
        actions = {
            update-props = {
                api.alsa.soft-mixer    = true
            }
        }
    }
]
MINERODO10 commented 1 day ago

That doesn't change the behavior at all. I did confirm the file was being loaded and applied by setting node.nick = "Test" and checking with the output of pw-cli ls

This problem might only be solved if alsa, pipewire, the kernel module(s), and whatever else is needed implement a non-hacky solution to multistreaming on Realtek audio cards, or at the bare minimum a way to map a pipewire sink volume slider to an alsa mixer slider.

A hacky solution might be to make a script to sync the value from PCM or the Sink itself to Line Out on alsa and make the Headphone sink ignore PCM completely (in the case of using it as the volume value source) in /etc/alsa-card-profile/mixer/paths/analog-output-headphone.conf since it sets it to 0dB each volume change. Once I get around to making it I will add another comment with a link to the repo on this issue in case anyone else needs it in a similar case, feel free to add the link to the instructions.

This issue can be closed now. thanks for everything and sorry for my bad England :)