How to change audio source in linux (KDE Plasma)?

i have this exact post posted on destination linux’s forum - https://discourse.destinationlinux.network/t/how-to-change-audio-source-in-linux-kde-plasma/1829/15

while switching from speakers to headphones in pavucontrol-qt as i was getting audio from both speakers and headphones at the same time by doing that so i took a look and noticed something (i deleted the sinks i created before in /etc//pulse/default.pa)

when im using default line out output (on the left in pavucontrol-qt) im getting audio from speakers marked with orange the front in alsamixer controls the volume of rear jack which is called line out in both pavucontrol-qt and kde volume manager which the alsa mixer has a line control if u look at alsamixer 4th from the right (the headphones volume in alsa is at max right now but i dont get any sound)

but when i change to headphones (on the left in pavucontrol-qt) im getting audio in headphones (marked green) and speakers (marked orange) same time but if i lower the volume of front in alsamixer (marked orange) i get audio in only headphones which is the front panel audio jack

if u can join me there we can talk there its hard to talk same thing over 2 different forums

well according to archwiki i ran “pacmd list-sinks” command and got this output there were 2 sinks 1 was the GPU HDMI output which is not useful here the other one is -->

        name: <alsa_output.pci-0000_00_1f.3.analog-stereo>
        driver: <module-alsa-card.c>
        flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: SUSPENDED
        suspend cause: IDLE
        priority: 9039
        volume: front-left: 15823 /  24% / -37.03 dB,   front-right: 15823 /  24% / -37.03 dB
                balance 0.00
        base volume: 65536 / 100% / 0.00 dB
        volume steps: 65537
        muted: no
        current latency: 0.00 ms
        max request: 0 KiB
        max rewind: 0 KiB
        monitor source: 1
        sample spec: s16le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        used by: 0
        linked by: 0
        configured latency: 0.00 ms; range is 0.50 .. 2000.00 ms
        card: 1 <alsa_card.pci-0000_00_1f.3>
        module: 7
        properties:
                alsa.resolution_bits = "16"
                device.api = "alsa"
                device.class = "sound"
                alsa.class = "generic"
                alsa.subclass = "generic-mix"
                alsa.name = "ALC892 Analog"
                alsa.id = "ALC892 Analog"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                alsa.device = "0"
                alsa.card = "0"
                alsa.card_name = "HDA Intel PCH"
                alsa.long_card_name = "HDA Intel PCH at 0xdf220000 irq 127"
                alsa.driver_name = "snd_hda_intel"
                device.bus_path = "pci-0000:00:1f.3"
                sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
                device.bus = "pci"
                device.vendor.id = "8086"
                device.vendor.name = "Intel Corporation"
                device.product.id = "a170"
                device.product.name = "100 Series/C230 Series Chipset Family HD Audio Controller"
                device.form_factor = "internal"
                device.string = "front:0"
                device.buffering.buffer_size = "352800"
                device.buffering.fragment_size = "176400"
                device.access_mode = "mmap+timer"
                device.profile.name = "analog-stereo"
                device.profile.description = "Analog Stereo"
                device.description = "Built-in Audio Analog Stereo"
                alsa.mixer_name = "Realtek ALC892"
                alsa.components = "HDA:10ec0892,1462f972,00100302"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-pci"
        ports:
                analog-output-lineout: Line Out (priority 9000, latency offset 0 usec, available: yes)
                        properties:

                analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: no)
                        properties:
                                device.icon_name = "audio-headphones"
        active port: <analog-output-lineout>

then according to wiki i added these lines in “/etc/pulse/default.pa”

load-module module-remap-sink sink_name=speakers sink_properties="device.description='Speakers'" remix=no master=alsa_output.pci-0000_00_1f.3.analog-stereo channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right

load-module module-remap-sink sink_name=headphones sink_properties="device.description='Headphones'" remix=no master=alsa_output.pci-0000_00_1f.3.analog-stereo channels=2 master_channel_map=rear-left,rear-right channel_map=front-left,front-right

then i got 2 sinks in the system tray widget after logging out and logging back in but none of those 2 sinks give any output nor speakers neither headphones

i recently added this thread to r/kde (Reddit) page. i posted this there no help so far. still looking for a solution.

wow absolutely no help, i have this thread 5 different places everywhere people stopped responding after a while no one asks me for some info or terminal output that i show or try to fix this. :confused:

It normaly change automativly but when I see that corractly your default device is the HDMI Output

in of the screenshots yes its showing default as HDMI but i have already tried switching default to headphones still wont work

Is the fron port of the case realy connected on the Moutherboard?

yes i dual boot windows for a couple of games and i use it in windows too.

Ok for trubelshoting try anouther distro that also runs with KDE Plasma(maybe one withe the same version and one with an newer version).

i have already tried it, doesn’t work. i have tried ubuntu and manjaro.

So I am thinking this is a hardware issue more than a software issue since you also have the issue with Ubuntu and Manjaro. The Realtek ALC892 is a pretty common chipset so I would find it odd that there would be major bugs like this considering how commonly used it is and the age of the chipset. Also although I didn’t have a KDE distro on a flash drive on hand I was able to test with Pop!_OS on a system that had a 892 chipset and it did detect when I plugged/unplugged headphones. Now I am assuming you were running standard Ubuntu and not Kubuntu meaning you also had the issue on Gnome if not then well I will test with a KDE distro when I get a chance.

Would be nice to know what headphones you are trying to use I’ve had issues on both Windows and Linux over the years recognizing headphones that had in-line microphones. Windows has improved on this over the years I believe so that could possibly be why it works on Windows, but it’s been awhile since I last used headphones that had an in-line mic so can’t say for sure. You could also just bypass the chipset by using a USB DAC instead.

you talking about the front panel ?
im using using arch linux with kde plasma as desktop, and when i said i tried on ubuntu and manjaro i did not installed them i just tested it while booting the live usb, and the headphones are basic standard headphones (HP branded) with 2 separate 3.5mm jacks for headphones and mic and a usb cable that is just for the led lights its does not do anything else. and in windows i have to go to the realtek audio manager software that came with the motherboard and turn off the front panel port for some reason then it detects, and shows a separate audio source in the taskbar as realtek 2nd audio output.

this is a old thread for windows 7 but its the same what i do windows10 has option to change output in the taskbar volume icon if u click on it you get different output options-
https://support.rm.com/TechnicalArticle.asp?cref=TEC1549541

Yes I was talking about the front panel, but just to make sure I understand it correctly you still had this issue when you did the live usb right?

As for what you have in Windows that is normally what it would read if you have allowed it to treat the front panel as a separate audio output (at least in my experience anyway). As in you could have a different audio stream going to your rear port than your front panel port. Used to do this with my old setup would have game audio/music going to my rear port and then Discord going through the front panel port. Not a 100% sure why it shows up that way when you disable the front panel header in the Realtek driver though

yes i had this issue even when using live usb.

yes i need some way to switch between the two so while playing games i dont have to unplug the speakers from rear and plug headphones there. i do same in windows i use front panel when playing games

Speakurs is yoir rear port, headphones is the front.

Open pulseaudio and hit the green checkmark in headphones under the output tab. Tada. Otherwise it should just autowitch.

You can also just bind the two together. Since its just an outuput, who cares.

Have you looked to see if your case has a front panel audio connector like this one?

5hZot

From the article you posted that is a work around for when you have an AC97 connector plugged into a HD Audio header. Found this post which had one person mentioning some boards had a BIOS option for whether to set the front panel header as HD Audio or AC97 might want to consult your boards manual for that since it may list the option as something different. As for a software workaround I found this post of what I think was someone else with a AC97 front panel connection. Also as I said earlier you could just get a USB DAC and bypass the front panel altogether.

i checked my bios settings, the only thing related to audio is enable or disable onboard audio, and this thread you sent me according to this i edited

/usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf

and changed this line

[Element Front]
switch = mute
volume = zero

to

[Element Front]
switch = off
volume = zero

and rebooted now by doing this
pacmd set-sink-port 1 analog-output-lineout
or
pacmd set-sink-port 1 analog-output-headphones

i can switch between headphones and speakers fine they dont have output at the same time.

so half of my problem is solved now. now i just need to separate those sinks so i have a 2 options in KDE audio widget to switch between the 2.

i have tried this again, adding these 2 lines in

"/etc/pulse/default.pa"
load-module module-remap-sink sink_name=speakers sink_properties="device.description='Speakers'" remix=no master=alsa_output.pci-0000_00_1f.3.analog-stereo channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right

load-module module-remap-sink sink_name=headphones sink_properties="device.description='Headphones'" remix=no master=alsa_output.pci-0000_00_1f.3.analog-stereo channels=2 master_channel_map=rear-left,rear-right channel_map=front-left,front-right

but it does not work still none of the sink i created gives me output to either speakers or headphones.

i tried adding this after sink_properties=

device.icon_name=audio-speakers
and
device.icon_name=audio-headphones

like this

load-module module-remap-sink sink_name=speakers sink_properties="device.description='Speakers' device.icon_name=audio-speakers" remix=no master=alsa_output.pci-0000_00_1f.3.analog-stereo channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right

load-module module-remap-sink sink_name=headphones sink_properties="device.description='Headphones' device.icon_name=audio-headphones" remix=no master=alsa_output.pci-0000_00_1f.3.analog-stereo channels=2 master_channel_map=rear-left,rear-right channel_map=front-left,front-right

by doing this if i switch to speakers sink in kde audio widget its now working but headphones sink still doesn’t work.

i can switch between the 2 in terminal now by pacmd set-sink command but i want this to in the widget

Just to make sure did you check whether your front panel audio had a breakout connection like the one I posted? The reason I am asking is because if it does switching to the HD Audio connector would just resolve this problem which would be the ideal solution to the problem because then the PC could tell when headphones were plugged/unplugged.

The problem you’re running into is that AC97 does not support SENSE as in it can’t tell if anything is plugged in so the audio controller is looking for whether there is anything connected to that port and then displaying a slider for it. Since it never sees anything plugged in there it doesn’t display it you need to do the step 1 of this section so that it will properly show up (Odemia actually linked this earlier). You should also try the rest of the steps they should get the behaviour you want. Although you may want to pay attention to the note at the bottom where it says you may need to use Element Front instead of Element Line Out since the line out connections volume didn’t go down until you turned the the Front slider down I think the master volume is tied to the Front one.

i checked the cable it doesn’t look like the one you showed. my mobo is MSI B-150M Mortar.

according to link you sent there is no

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

in /usr/share/pulseaudio/alsa-mixer/paths/analog-output-lineout.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 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 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 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 here is the /usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.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/>.

; Path for mixers that have a 'Headphone' control
;
; See analog-output.conf.common for an explanation on the directives

[General]
priority = 99
description-key = analog-output-headphones

[Properties]
device.icon_name = audio-headphones

[Jack Dock Headphone]
required-any = any

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

[Jack Front Headphone]
required-any = any

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

[Jack Headphone]
required-any = any

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

# This jack can be either a headphone *or* a mic. Used on some ASUS netbooks.
[Jack Headphone Mic]
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 Master Mono]
switch = off
volume = off

[Element Speaker+LO]
switch = off
volume = off

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

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

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

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

; This profile path is intended to control the first headphones, not
; the second headphones. But it should not hurt if we leave the second
; headphone jack enabled nonetheless.
[Element Headphone2]
switch = mute
volume = zero

[Element Speaker]
switch = off
volume = off

[Element Desktop Speaker]
switch = off
volume = off

; On some machines Front is actually a part of the Headphone path
[Element Front]
switch = off
volume = zero

[Element Rear]
switch = off
volume = off

[Element Surround]
switch = off
volume = off

[Element Side]
switch = off
volume = off

[Element Center]
switch = off
volume = off

[Element LFE]
switch = off
volume = off

[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

there is also a /usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones-2.conf

The case would be nice to know since it’s what that cable would be coming from since it’s the cases connector that would be causing the issue, but I am sort of doubtful that it would have a AC97 connection on that case considering the age of the mobo. Maybe it’s just a really weird audio implementation on MSI’s part.

As for the differences between the Arch Wiki ya I just looked at my files on my install and they are the same way the jack for the headphone is in the headphones.conf file. My guess is that section of the wiki is outdated and pulse moved it into the headphones configuration file. So just edit that field in the headphones one since they did mention on one of the other steps you would need to add it to the config file but they didn’t do mention it for that step. Not 100% sure what the Phantom means in some of those fields I have it in mine as well, but I didn’t find any documentation about it really when looking. Personally have never had to dig into the audio conf files it’s just worked for me so I am just guessing from what I can see in the documentation and what I can find elsewhere.

in headphone config file there is just

[Jack Headphone]
required-any = any

so i just added these 2 lines

state.plugged = no
state.unplugged = unknown

changed no to yes

restarted pulseaudio -k and pulseaudio --start

still nothing…