Pulseaudio - Issue with independent hdmi / internal audio

Questions about codecs, DVD playback, web plugins...
Forum rules
Before you post please read how to get help
Post Reply
KarolJank
Level 1
Level 1
Posts: 7
Joined: Tue Oct 27, 2020 6:48 am

Pulseaudio - Issue with independent hdmi / internal audio

Post by KarolJank »

Hello,

I am newbie linux user and i faced big issues with audio configuration just before system install

On Windows I'm using very often different audio outputs for different aps like headphones for firefox and hdmi output for edge to play something else on TV

First issue i had was that HDMI output was treated like one device with headphones/speakers/hdmi so i could use only one at a time

Later i managed to find a topic https://unix.stackexchange.com/question ... up-in-puls

With its help i made a profile, it loads correctly, i am able to set one app to use speakers/headphones and other to use HDMI

BUT, when audio plays through HDMI and i connect/disconnect headphones, audio from HDMI disappears(while it should still play indepentendly) and doesnt come back until restarting pulseaudio

Is there anyone who might know how to fix this?
User avatar
MrEen
Level 22
Level 22
Posts: 15238
Joined: Mon Jun 12, 2017 8:39 pm

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by MrEen »

Hi KarolJank, and welcome to the forum.

The easiest solution is to install (if necessary) and run PulseAudio Volume Control (pavucontrol) and use the Playback tab to direct the different outputs where you want them.
KarolJank
Level 1
Level 1
Posts: 7
Joined: Tue Oct 27, 2020 6:48 am

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by KarolJank »

Thank you for answer, but i think i will have to write more precise what the issue is

When i install fresh system there is headphone/speaker/hdmi join into one "sink?" So even with pavucontrol there is no possibility to manage outputs since all three are joined in one option

Then i found solution from topic above which makes profile that splits headphones/speakers and hdmi to two different devices so after that in pavucontrol there is option to manage which app should use speakers/headphone and which should use hdmi so on first look it works I excepted

Image

Everything works fine till the moment i do not touch jack ports:

Firefox is set to use HDMI
Edge is set to use speakers/headphones

Firefox plays music, i connect jack and it stops playing anything through HDMI(also sound which should go through HDMI doesnt appear on speakers/headphones) and sound doesnt come back until i use pulseaudio -k
firefox plays music, i disconnect jack and it stops playing anything through HDMI again and i have to restart pulseaudio again
User avatar
MrEen
Level 22
Level 22
Posts: 15238
Joined: Mon Jun 12, 2017 8:39 pm

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by MrEen »

Show me the Playback tab when this happens. You should be able to change the one you want there I believe.
KarolJank
Level 1
Level 1
Posts: 7
Joined: Tue Oct 27, 2020 6:48 am

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by KarolJank »

Right now
playing youtube from Edge to headphones/speaker device (headphones are plugged in at the moment)
playing youtube from Firefox on TV
Everything works as expected, tv outputs sound from firefox, headphones output sound from edge

Image

Now i do something with jack port - since i have headphones plugged in, i disconnect them (or reverse)
Sound from firefox(hdmi) crashes. There is no more any sound from it. It is not redirected to speaker/headphones, sound just disappears in black hole
pavucontrol shows that some sound is outputted, but its being outputted into nothing

Image


So every time i plug in/ plug out headphones i have to make pulseaudio -k and reopen / refresh app that is assigned to HDMI


It looks like audio drivers are interfering somehow with the configuration and tries to redirect sound from HDMI to headphones/speakers when it detects any change in speaker/headphones port, but we dont want it since all we want to have is to have app using always HDMI and never change it no matter what user does with headphones/speakers


#edit
Of course, i can change firetox to use analog-stereo in playback settings and sound from firefox is played correcly on headphones/speakers, but changing it back to hdmi results in silence, then i open terminal and kill pulseaudio, reload youtube and it works again

Code: Select all

karol@karol:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
User avatar
MrEen
Level 22
Level 22
Posts: 15238
Joined: Mon Jun 12, 2017 8:39 pm

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by MrEen »

Okay, understood.

I think what is happening is the port change is triggering the default behavior but you're using a modified setup. My guess is the custom profile set is getting discarded when the port change triggers.

There might be a way to use an additional udev rule to handle this the way you want, but that's a bit above my head. Later on, I'll take a stab at coming up with ideas, but I have some work to do around the home right now.

I might need some info that should be covered with the output from this command:

Code: Select all

curl https://gitlab.freedesktop.org/pulseaudio/pulseaudio/raw/master/src/utils/pa-info?inline=false | bash | nc termbin.com 9999
That will have a URL on the last line pointing to your sound setup.
KarolJank
Level 1
Level 1
Posts: 7
Joined: Tue Oct 27, 2020 6:48 am

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by KarolJank »

https://termbin.com/cb93

configs i used to split speakers/headphones/hdmi to independent speakers/headphones || hdmi


/etc/udev/rules.d/91-pulseaudio-intel.rules

Code: Select all

# Custom Profile for onboard Intel 8086:1e20

SUBSYSTEM!="sound", GOTO="xpulseaudio_end"
ACTION!="change", GOTO="xpulseaudio_end"
KERNEL!="card*", GOTO="xpulseaudio_end"

SUBSYSTEMS=="pci", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x1e20", ENV{PULSE_PROFILE_SET}="intel-hdmi+analog.conf"

LABEL="xpulseaudio_end"
/usr/share/pulseaudio/alsa-mixer/profile-sets/intel-hdmi+analog.conf

Code: Select all

[General]
; # Instead of defining all profiles manually, autogenerate
; # them by combining every input mapping with every output mapping
auto-profiles = yes

[Mapping analog-stereo]
device-strings = front:%f
channel-map = left,right
paths-output = analog-output-speaker analog-output-headphones
paths-input = analog-input-internal-mic analog-input-headset-mic
priority = 15

[Mapping hdmi-stereo]
description = Digital Stereo (HDMI)
device-strings = hdmi:%f
paths-output = hdmi-output-0
channel-map = left,right
priority = 9
direction = output

[Profile output:analog-stereo+output:hdmi-stereo+input:analog-stereo]
description = Analog Stereo + Digital Stereo (HDMI) + Analog Stereo Input
output-mappings = analog-stereo hdmi-stereo
input-mappings = analog-stereo

[Profile output:analog-stereo+output:hdmi-stereo]
description = Analog Stereo + Digital Stereo (HDMI)
output-mappings = analog-stereo hdmi-stereo
User avatar
MrEen
Level 22
Level 22
Posts: 15238
Joined: Mon Jun 12, 2017 8:39 pm

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by MrEen »

I'm an idiot. I was expecting a different vendor ID and device ID, but of course they are the same.

There could still be a way to do this, but it really is over my head. The built-in audio is card 0 device 0 while the HDMI audio is card 0 device 2. That's why I was expecting different ID's.

Maybe, if you're interested in trying it, we could see if turning off jack detection makes any difference. You should still be able to manually change things from speaker to headphones or vice versa. Like I said, it seems like the jack detection firing is the cause of your issue, so stopping that might work for you. But it's also possible that it'll stop the sound being sent to nowhere upon plugging/unplugging the headphones, but it'll still happen when you manually make the change.
KarolJank
Level 1
Level 1
Posts: 7
Joined: Tue Oct 27, 2020 6:48 am

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by KarolJank »

I tried to separate all 3 outputs but since im using linux for 3 days, its above my skills
Config i used was just copypaste of another solution and tweaking id

I think it might be worth trying. This would be better workaround than spamming pulseaudio -k and restarting apps like i have to do now
User avatar
MrEen
Level 22
Level 22
Posts: 15238
Joined: Mon Jun 12, 2017 8:39 pm

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by MrEen »

Okay, install alsa-tools-gui so you can run HDAJackRetask. When it opens, check the Parser hints box then in the list that opens double click on jack_detect until it says no. Click on Install boot override then reboot and start testing.

If that makes things worse, or just doesn't help at all, you can undo it by running HDAJackRetask again and clicking on Remove boot override then rebooting once more.
KarolJank
Level 1
Level 1
Posts: 7
Joined: Tue Oct 27, 2020 6:48 am

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by KarolJank »

I tried your solution, but unfortunately it crashes also in the moment when i choose speakers/headphones manually

looks like it is not issue of jack detection. I might guess that even tho i have profile to split hdmi and internal audio for pulseaudio, maybe alsamixer doesnt understand that and any action with internal audio forces loading some configuration that doesnt include independent hdmi support

Thats a complete guess, but when hdmi is connected, there is no single volume setting for hdmi in alsamixer, only master/speaker/headphone and spdif which is not existing in this laptop

Maybe the issue is that alsamixer doesnt understand that something is playing through hdmi because of pulseaudio making it to do so, but any action with internal audio causes conflict with alsa so it tries to play this audio through internal, but somewhere in the middle custom config tries to redirect it to hdmi and sound gets lost completely

Well, looks like in terms of managing audio windows 10 did a really nice job since it works with litreally 0 engagement. Since i need linux to learn programming, i'll have to learn living with that quirk and repeat killing pulseaudio or just use bluetooth headphones

Thank you for support
User avatar
MrEen
Level 22
Level 22
Posts: 15238
Joined: Mon Jun 12, 2017 8:39 pm

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by MrEen »

There is one more thing to look at. Oops, no there isn't. I was going to suggest making sure nothing was muted in alsamixer, but your earlier screenshots took care of that.

The only suspicion I can come up with is this. If you had two different audio cards, and ran pacmd set-default-sink alsa.card.1 to change the default output, that doesn't change the currently playing streams (although it should when PulseAudio 14 comes out.) Maybe because of the split you've made, a similar thing is happening here.

You can try to test this theory by playing something new, such as opening a new tab in the affected browser and seeing if starting a new Youtube video does play properly.

It's just a shot in the dark, but might help explain what's happening.
KarolJank
Level 1
Level 1
Posts: 7
Joined: Tue Oct 27, 2020 6:48 am

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by KarolJank »

Unfortunately,
  • first thing i tried to do when issue occured was trying to turn off media and turn it on again so it reapperars in pavucontrol, didnt work
  • also tried to reassaign totally different app, didnt work
  • tried to test audio output, didnt work
  • then i tried to reset it with pulseaudio -k, didnt work
  • and in the end i tried to reset pulseaudio -k and reload page and then it starts working proplerly


looks like alsa with pulseaudio has issues with supporting laptops having speakers/headphones/hdmi, joind them into one output and splitting it into sinks is not fully supported, or some defuault configuration outside pulseaudio causes it (some default alsa config itself?)

repeating pulseaudio -k is not the worst workaround on planet, but definitely this is not how it supposed to work
User avatar
MrEen
Level 22
Level 22
Posts: 15238
Joined: Mon Jun 12, 2017 8:39 pm

Re: Pulseaudio - Issue with independent hdmi / internal audio

Post by MrEen »

KarolJank wrote:
Fri Oct 30, 2020 4:02 am
repeating pulseaudio -k is not the worst workaround on planet, but definitely this is not how it supposed to work
Until your first post, I didn't even know splitting the built-in card up like you did was even possible. As you can see at the URL you posted, that was a pretty fresh question, and I wouldn't be surprised if you had quite some difficulty finding another similar answer elsewhere on the web.

What you did is entirely PulseAudio concerned. No ALSA involved essentially. You might try asking here as the real experts might be able to sort this out for you. If you go that route, and do get this fixed, please come back and mention how it was solved. I'm sure it will others in the same boat.

Good luck! :D
Post Reply

Return to “Sound, Multimedia, & Codecs”