bazzite icon indicating copy to clipboard operation
bazzite copied to clipboard

Bazzite HTPC Edition is not remembering last sound output

Open JaCh0o opened this issue 1 year ago • 16 comments

Describe the bug

Hello, Every time I restart/turn off/update BazziteOS I have to change sound output settings from mini Jack to sound thru HDMi to my TV. Is there any chance to correct this ?

What did you expect to happen?

I would expect to just set it once and I won't change to any other or this one will disappear it will be set permanently.

Output of rpm-ostree status

No response

Hardware

No response

Extra information or context

No response

JaCh0o avatar Mar 25 '24 11:03 JaCh0o

This is because Valve doesn't set defaults for audio in Game Mode. They rely on Wireplumber to set the default. You can try going into desktop mode and changing the sound output in the system settings by going into Audio --> Devices --> and fiddling with audio profiles. I assume you're using KDE Plasma because you didn't give any information on that.

nicknamenamenick avatar Mar 25 '24 18:03 nicknamenamenick

Você precisa desativar o fone de ouvido como fonte de áudio no modo desktop, deixe apenas o HDMI como opção disponível

E5ants avatar Mar 28 '24 15:03 E5ants

I have the same problem. Set the default audio device to Navi 21/23 HDMI/DP in desktop mode. After switching to game mode the default audio device is set to Default (Auto) and it uses the Audio Adapter (Unitek Y-247A).

System: Minisforum HX99G Bazzite 39 (latest)

BigNerv avatar Mar 30 '24 07:03 BigNerv

Actually I really don't understand why bizzite os can't correct something which is clearly it's problem. Steam deck as console just don't have any other similar outputs as pc based steam consoles with bazzite os.

sob., 30 mar 2024, 08:20 użytkownik BigNerv @.***> napisał:

I have the same problem. Set the default audio device to HDMI in desktop mode. After switching to game mode the default audio device is set to speaker out.

— Reply to this email directly, view it on GitHub https://github.com/ublue-os/bazzite/issues/912#issuecomment-2027951296, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWK7S4IOHRKXEDIA4EO6OLTY2ZKRTAVCNFSM6AAAAABFG2SV56VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRXHE2TCMRZGY . You are receiving this because you authored the thread.Message ID: @.***>

JaCh0o avatar Mar 30 '24 08:03 JaCh0o

You have to go to the audio settings in desktop mode and disable headphones as an output. then only HDMI will remain, which will remain as default. In my case it worked.

E5ants avatar Mar 30 '24 12:03 E5ants

Actually I really don't understand why bizzite os can't correct something which is clearly it's problem. Steam deck as console just don't have any other similar outputs as pc based steam consoles with bazzite os. sob., 30 mar 2024, 08:20 użytkownik BigNerv @.***> napisał: I have the same problem. Set the default audio device to HDMI in desktop mode. After switching to game mode the default audio device is set to speaker out.

It's a Steam Gaming Mode "issue" and because it's proprietary software, we cannot have a universal fix for all hardware.

nicknamenamenick avatar Apr 02 '24 23:04 nicknamenamenick

Steam game mode defaults to whatever Wireplumber's configured default is. You will need to adjust your configs to correct this.

KyleGospo avatar Apr 02 '24 23:04 KyleGospo

How do I modify the WirePlumber config if it’s in /usr/share? Isn’t that directory not able to be modified on ublue?

Cm4nXD avatar Jun 07 '24 22:06 Cm4nXD

How do I modify the WirePlumber config if it’s in /usr/share? Isn’t that directory not able to be modified on ublue?

It can be modified with configuration files in your home directory, and in /etc

KyleGospo avatar Jun 07 '24 22:06 KyleGospo

Steam game mode defaults to whatever Wireplumber's configured default is. You will need to adjust your configs to correct this.

how can we adjust this? i'm new on linux

ThiagoLuiz2001 avatar Jun 15 '24 13:06 ThiagoLuiz2001

Here is an example I have posted in the forums. Reposting as below

I'm only posting this in the perspective of non-deck version of Bazzite (i.e. no game/deck mode). I have a problem that Bazzite switches the default audio device to the onboard sound card when I starts a sunshine stream. I found that the order of audio device is determined by wireplumber. I have successfully set my desktop to use my HDMI monitor (actually connected via DisplayPort) as the default audio device without disabling the onboard sound card.

First, open a terminal, run wpctl status and note the ID next to each sink under Audio

k7so@bazzite:~$ wpctl status
...
Audio
 ├─ Devices:
 │      50. Renoir Radeon High Definition Audio Controller [alsa]
 │      51. Family 17h/19h HD Audio Controller  [alsa]
 │  
 ├─ Sinks:
 │      53. Family 17h/19h HD Audio Controller Digital Stereo (IEC958) [vol: 1.00]
 │  *   62. Renoir Radeon High Definition Audio Controller Digital Stereo (HDMI 2) [vol: 0.64]
 │  
 ├─ Sources:
 │      54. Family 17h/19h HD Audio Controller Analog Stereo [vol: 1.00]
 │  
 ├─ Filters:
 │  
 └─ Streams:
...

Note that the ID for "Family 17h..." (my onboard sound card) is 53 and that for HDMI is 62.

Then, run wpctl inspect <id>, where <id> is the ID I mentioned above. Note the value for priority.driver and priority.session.

k7so@bazzite:~$ wpctl inspect 53
id 53, type PipeWire:Interface:Node
...
  * node.description = "Family 17h/19h HD Audio Controller Digital Stereo (IEC958)"
    node.driver = "true"
  * node.name = "alsa_output.pci-0000_06_00.6.iec958-stereo"
...
  * priority.driver = "736"
  * priority.session = "736"
k7so@bazzite:~$ wpctl inspect 62
id 62, type PipeWire:Interface:Node
...
  * node.description = "Renoir Radeon High Definition Audio Controller Digital Stereo (HDMI 2)"
    node.driver = "true"
  * node.name = "alsa_output.pci-0000_06_00.1.hdmi-stereo-extra1"
...
  * priority.driver = "632"
  * priority.session = "632"

You can see that the priority for the onboard card is 736, while that for the HDMI is 632. As the onboard sound card has higher priority it will be preferred.

To fix this, we can add a config file to override the priority value for the onboard card.

Open Kate (the text editor), open a new file and paste the following contents:

monitor.alsa.rules = [
  {
    matches = [
      {
        node.name = "alsa_output.pci-0000_06_00.6.iec958-stereo"
      }
    ]
    actions = {
      update-props = {
         priority.driver = 500
         priority.session = 500
      }
    }
  }
]

In the config the part after node.name should match the node.name as shown in the wpctl inspect output. I change the priority from 736 to 500 so that it will be lower than that for my HDMI.

Save this file as /home/<your username>/.config/wireplumber/wireplumber.conf.d/51-deprio-onboard.conf. In other words, we put this file into the /home/<your username>/.config/wireplumber/wireplumber.conf.d/ directory (you need to create the intermediate directories yourself). And the name for the file is 51-deprio-onboard.conf (actually only the beginning 51- and file extension .conf matter, you can name the middle part to anything as you wish).

After placing that config file, run the command systemctl --user restart wireplumber to restart the wireplumber service.

Double check the priorities using wpctl status and wpctl inspect <id> (note that the ID will change after restarting wireplumber). You can see that the priority has been changed as desired.

Adapt this to your needs. Just remember that the priority should not be set to higher than 1500.

Reference: https://blog.zenlinux.com/2022/08/how-to-configure-audio-device-priorities-in-pipewire-wireplumber/ (However the configuration part is outdated)

Edit: I played around the sound setting a little more and found that the "Default Configured Devices" shown in wpctl status also matters. If there is the device that matches the default configured device, then that device should be chosen as the output. If not the device with highest priority will be chosen. It can be changed by wpctl set-default <id> or just by selecting that device in KDE.

kennethso168 avatar Jul 01 '24 10:07 kennethso168

For me this does not work because it is not the wrong device, it is the wrong output selected.

Always output:hdmi-stereo-extra1 instead of output:hdmi-surround-extra1.

So since the update to Fedora 40 i have only stereo sound, before that update everything was fine. Now bazzite can't even play 5.1 sound for me anymore in gamemode.

RayBa82 avatar Jul 05 '24 19:07 RayBa82

I made a wireplumber config, that always the 5.1 profile is selected for the device and put it in "/home//.config/wireplumber/wireplumber.conf.d/51-deprio-onboard.conf", but this does not help.

After a reboot always stereo is selected until i ssh into bazzite and do "systemctl --user restart wireplumber". Restarting wireplumber sets the audio to 5.1 as configured in my config.

So How can I make this annoying process as ist was before? Obviously my wireplumber config is ignored on boot....

RayBa82 avatar Jul 07 '24 11:07 RayBa82

Please post your config file and the complete output of wpctl status

kennethso168 avatar Jul 07 '24 13:07 kennethso168

Sorry I deleted my config file and wiped everything, did a fresh clean install of bazzite deck image and it is still not working....

This is so damn annoying. I will try to recreate my config, since this is obviously the only way to get surround sound running with bazzite...

RayBa82 avatar Aug 10 '24 18:08 RayBa82

@JaCh0o I was having the same issue, managed to fix it by setting the onboard audio card to Inactive state on Desktop Mode. After reboot the audio was kept on HDMI.

GalaticStryder avatar Aug 12 '24 22:08 GalaticStryder

This is my config file, I don't have problems with selecting the right card, for me the stereo profile is always selected after every boot or when switching between desktop and gamemode.

This file is located in "/home/bazzite/.config/wireplumber/wireplumber.conf.d/51-surround.conf"

When I ssh into bazzite after gamemode is started and doing "systemctl --user restart wireplumber" 5.1 sound is working.

Please provide me a way to have it working like before, without ever touching any config files or ssh into bazzite everytime you want to play...

monitor.alsa.rules = [
  {
    matches = [
      {
         alsa.name = "HDMI 1"
      }
    ]
    actions = {
      update-props = {
         device.profile = "hdmi-surround-extra1"
      }
    }
  }
]

"wpctl status" output after boot

wpctl status
PipeWire 'pipewire-0' [1.0.7, bazzite@bazzite, cookie:918612595]
 └─ Clients:
        31. uresourced                          [1.0.7, bazzite@bazzite, pid:5874]
        32. WirePlumber                         [1.0.7, bazzite@bazzite, pid:5897]
        40. WirePlumber [export]                [1.0.7, bazzite@bazzite, pid:5897]
        51. Chromium input                      [1.0.7, bazzite@bazzite, pid:7198]
        53. wpctl                               [1.0.7, bazzite@bazzite, pid:7978]
        64. gamescope                           [1.0.7, bazzite@bazzite, pid:6060]
        67. pipewire                            [1.0.7, bazzite@bazzite, pid:6412]
        68. Steam Voice Settings                [1.0.7, bazzite@bazzite, pid:6274]
        69. Steam                               [1.0.7, bazzite@bazzite, pid:6274]

Audio
 ├─ Devices:
 │      41. Navi 31 HDMI/DP Audio               [alsa]
 │      42. Rembrandt Radeon High Definition Audio Controller [alsa]
 │      43. Family 17h/19h HD Audio Controller  [alsa]
 │
 ├─ Sinks:
 │  *   47. Navi 31 HDMI/DP Audio Digital Stereo (HDMI 2) [vol: 1.00]
 │
 ├─ Sources:
 │
 ├─ Filters:
 │
 └─ Streams:

Video
 ├─ Devices:
 │      58. OBS Virtual Camera                  [v4l2]
 │
 ├─ Sinks:
 │
 ├─ Sources:
 │  *   65. (null)
 │
 ├─ Filters:
 │
 └─ Streams:

Settings
 └─ Default Configured Devices:

"wpctl status" after connecting via ssh into bazzite and executing "systemctl --user restart wireplumber"

wpctl status
PipeWire 'pipewire-0' [1.0.7, bazzite@bazzite, cookie:918612595]
 └─ Clients:
        31. uresourced                          [1.0.7, bazzite@bazzite, pid:5874]
        43. WirePlumber [export]                [1.0.7, bazzite@bazzite, pid:8060]
        51. Chromium input                      [1.0.7, bazzite@bazzite, pid:7198]
        58. WirePlumber                         [1.0.7, bazzite@bazzite, pid:8060]
        64. gamescope                           [1.0.7, bazzite@bazzite, pid:6060]
        67. pipewire                            [1.0.7, bazzite@bazzite, pid:6412]
        68. Steam Voice Settings                [1.0.7, bazzite@bazzite, pid:6274]
        69. Steam                               [1.0.7, bazzite@bazzite, pid:6274]
        71. wpctl                               [1.0.7, bazzite@bazzite, pid:8072]

Audio
 ├─ Devices:
 │      32. Family 17h/19h HD Audio Controller  [alsa]
 │      41. Rembrandt Radeon High Definition Audio Controller [alsa]
 │      42. Navi 31 HDMI/DP Audio               [alsa]
 │
 ├─ Sinks:
 │  *   39. Navi 31 HDMI/DP Audio Digital Surround 5.1 (HDMI 2) [vol: 1.00]
 │
 ├─ Sources:
 │
 ├─ Filters:
 │
 └─ Streams:

Video
 ├─ Devices:
 │      60. OBS Virtual Camera                  [v4l2]
 │
 ├─ Sinks:
 │
 ├─ Sources:
 │  *   65. (null)
 │
 ├─ Filters:
 │
 └─ Streams:

Settings
 └─ Default Configured Devices:

"wpctl status" does not show inactive devices, I don't think this is very useful.

The main problem for me is, where can I configure it persistently? Even if that would mean I need to fiddle around with this config shit, I really need a solution.

RayBa82 avatar Aug 19 '24 18:08 RayBa82

I have multiple versions of a working wireplumper system.d configs which work all after doing a manual "systemctl --user restart wireplumber" after a reboot. Played around with priorities, default sink and all that stuff. I am out of options. Nothing works! The wireplumber rules are just not applied after reboot or have other timing issues.

Last try is now to setup a service which just executes this command 30s after a reboot, maybe that helps me at least to avoid to do this manually after every reboot....

I am fighting this issue now for months, it is getting ridiculous that there is no solution for that...

RayBa82 avatar Aug 20 '24 21:08 RayBa82

Ok my "final" solution which seems to work is the following:

  • create a working wireplumber.conf as in any examples explained before this post (just verify "wpctl status" after doing "systemctl --user restart wireplumber", output depends on your hardware)
  • create a service file which will be executed by a timer after boot: vi ~/.config/systemd/user/set-surround.service
  • paste the following content into that file:
[Unit]
Description=Set Sink in PipeWire (user session)

[Service]
Type=oneshot
ExecStart=systemctl --user restart wireplumber

[Install]
WantedBy=default.target
  • create a timer which is executed on boot: vi ~/.config/systemd/user/set-surround.timer
  • paste the follwowing content into that file:
[Unit]
Description=Wait some second before run set-surround.service

[Timer]
OnActiveSec=60sec
AccuracySec=1s

[Install]
WantedBy=timers.target
  • execute "systemctl --user daemon-reload"
  • execute "systemctl --user enable set-surround.timer"
  • reboot the system

Tadaaaaa:

60 seconds after boot I have 5.1 sound working. Wow, that was easy and user friendly. Months of not having surround sound in bazzite after boot is now finally solved for me (Until I need to setup a clean install and I will probably not remember this anymore).

Before I just selected in desktop mode the sound setup and the settings were also valid in game mode.

Tell that any Windows user and they will never ever even consider to use this OS :-D

RayBa82 avatar Aug 20 '24 22:08 RayBa82