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

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…

I needed to change Jack Front Headphone for mine to show up as being plugged in.

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

Followed the rest of the steps and it didn’t give me a separate slider so I am guessing that whole section is just completely outdated, but when I clicked on my speaker/headphone in the audio controller on the desktop it did allow me to switch output from speakers to headphones so this might resolve your issue.

As for the front panel of the case I had another thought it could be a HD Audio connector for the front panel audio but the SENSE lines could be damaged in some way so it’s not getting the signal for being plugged in. You could test it by using another cases front panel audio header that you know is HD Audio, you could also try a 5.25" bay hub that has audio/usb, or just getting a replacement front panel audio/usb port to test with (didn’t see any just audio front panel connectors that could be purchased for testing). Personally if it was me I would like to know if it was an issue with the case because if I reused the case I would continue to have this problem.

but im able to switch the output by doing this
pacmd set-sink-port 1 analog-output-lineout
or this
pacmd set-sink-port 1 analog-output-headphones

so there should be a way to make those 2 separate sink show in widget. maybe need to add some parameter and the "/etc/pulse/default.pa" file somewhere.

and it says there

“Now you have two separate ports on the same sink in pulseaudio. They mute each other, so you can switch to headphones and this will mute Line Out, and vice versa. To switch between ports you can use Gnome or Plasma sound mixer, or install appropriate desktop extension”

my first problem was when i switch the ouput to headphone i get audio in both the speakers and headphone at the same time but editing the headphone config in /usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf changed switch from mute to off

[Element Front]
switch = off
volume = zero

i can now mute the other output like when i switch to headphone speakers get muted.

so half my problem is solved there. now just need 2 separate sliders in widget somehow

I can switch in the GUI between either Line Out or Headphones and the volumes are not tied between the two with just me editing the portion I said I edited so I am not 100% sure what else to tell you. Unless what you are asking is that you want both speakers AND headphones outputting different audio streams then yes you would need a separate sink for that, but if all you want is to have a separate volume setting for your headphones than your speakers I believe it should already function that way.

i dont want both speakers and headphones outputting different audio streams at the same time.

and i can switch between the 2 ports from terminal just fine by these commands
pacmd set-sink-port 1 analog-output-lineout
or this
pacmd set-sink-port 1 analog-output-headphones

what i want is a option in in widget to be able to change the source. rather than going to terminal every time i want to switch.

the headphones are connected to the front panel always.
by default my KDE audio widget is like this (just the speakers are showing)
Screenshot_20200607_051432

by adding these :point_down: 2 lines in "/etc/pulse/default.pa" (according to the wiki) and rebooting the machine

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

i get this -

Screenshot_20200607_051826

but those 2 new sinks that are created do nothing if i change to “Speakers” no output from either speakers or headphones same with when i switch to “Headphones” no output from speakers or headphones they dont do anything.

maybe the 2 lines i added need something there to specify which sink controls what port like

Speakers controls = pacmd set-sink-port 1 analog-output-lineout

Headphones controls =pacmd set-sink-port 1 analog-output-headphones

hope this explains.

You shouldn’t require sinks to do that was my point I simply changed the [Jack Front Headphone] to

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

And it then allowed me to just click on line out in the GUI and switch it to headphones. Don’t believe there was anything particularly special on that install, but I won’t have a chance to check for a day or two since that PC is at my business.

where/which GUI are you talking about. can you show a screenshot?

yes, finally its working now thank you for bearing with me :smiley:
omg finally :smiley:

THIS IS THE SOLUTION

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

i now have a drop down menu in the widget to switch to headphones. so basically i needed to change the element front switch to off and then change this jack front headphone to this.

OMG it’s a wonder I’ve found this thread after two days of googling around. I had the same problem (KDE in Kubuntu 20.04): when I selected “Line out” in pulse-pa there was sound through rear-connected speakers and no sound through headphones (as expected). But when I selected “Headphones” the sound went through both speakers and headset. Turns out the combination of your edits in /usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf is the solution:

[Element Front]
switch = off
volume = zero

[Jack Front Headphone]
required-any = any
state.plugged = yes
state.unplugged = unknown
1 Like