You are not logged in.

#1 2024-12-18 14:48:49

jerryDaBaaws
Member
Registered: 2020-06-08
Posts: 108

Wireplumber set media role on a sink stream [SOLVED]

I want to use pipewire's ducking feature to suppress the background sounds in event of notfication.
from what i could find, pipewire does this automatically if there is a media role higher than other input streams.

I used `play` command from `sox` package to play a wav file, and on checking the stream info using `pw-cli info all` it seems like that it has no such role.
i cant figure out how to assign this role to manual streams, from what examples i could find, this is hardcoded in apps.

please help me getting this to work

Last edited by jerryDaBaaws (2024-12-21 03:46:50)

Offline

#2 2024-12-18 16:35:16

jerryDaBaaws
Member
Registered: 2020-06-08
Posts: 108

Re: Wireplumber set media role on a sink stream [SOLVED]

I use `play` command from `Sox` package to play a wav file along with notifications.
now that pipewire has removed the ducking module, and replaced it with behaviour of ducking other sounds when a stream of media has property `media.role` is of higher privilege than most.

so using pipewire config, i was trying to assign this property to streams produced by sox package.

.config/wireplumber/wireplumber.conf.d/60-role.conf

monitor.alsa.rules = [
  {
    matches = [
      {
        node.name = "SoX"
      }
    ]
    actions = {
      update-props = {
        media.role = "Music",
      }
    }
  }
]

but it doesnt have any effect whatsoever.
I tried to look into documentation, but no avail, setting it via this method seems to be only solution but its not working when i play sound using play command, and check info via `pw-cli info all`
property `media.role` is always absent from it

any clue on what the issue is, or what i can do to get the desired behaviour

Last edited by jerryDaBaaws (2024-12-18 16:36:54)

Offline

#3 2024-12-18 18:33:25

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,840

Re: Wireplumber set media role on a sink stream [SOLVED]

https://pipewire.pages.freedesktop.org/ … ccess.html contains the gist of it, you can listen to a certain client connecting and update prop the media.role

Also please don't crosspost, you basically created a new thread for the same issue.

Merging...

As for the attempt you had, alsa rules are for device rules, access rules for client rules, that's likely the relevant difference.

Last edited by V1del (2024-12-18 18:50:32)

Online

#4 2024-12-19 03:38:07

jerryDaBaaws
Member
Registered: 2020-06-08
Posts: 108

Re: Wireplumber set media role on a sink stream [SOLVED]

thanks for replying, sorry about the crossposting, i realized it later that it would be more relevant here

So i modified the file `$HOME/.config/wireplumber/wireplumber.conf.d/60-role.conf`

access.rules = [
  {
    matches = [
      {
        node.name = "SoX"
      }
    ]
    actions = {
      update-props = {
        default_permissions = "all",
        media.role = "Music",
        node.nick = "My Node"
      }
    }
  }
]

still no change which is desired

Offline

#5 2024-12-19 09:30:59

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,840

Re: Wireplumber set media role on a sink stream [SOLVED]

you restarted wireplumber after the change? You are sure SoX is the correct node.name?

Online

#6 2024-12-19 09:34:12

jerryDaBaaws
Member
Registered: 2020-06-08
Posts: 108

Re: Wireplumber set media role on a sink stream [SOLVED]

yea i restarted wireplumber and pipewire both, and I tried with both settings, application.name and node.name from info dump i got from ` pw-cli info all `

*	properties:
*		client.api = "pipewire-pulse"
*		pulse.server.type = "unix"
*		application.name = "SoX"
*		application.process.id = "695581"
*		application.process.user = "kushy"
*		application.process.host = "kushy-pc"
*		application.process.binary = "sox"
*		application.language = "C"
*		window.x11.display = ":0"
*		application.process.machine-id = "5915f7aa3d9b455fb1a29b84c08c3e7b"
*		application.process.session-id = "56"
*		media.name = "playback"
*		node.rate = "1/44100"
*		node.latency = "4630/44100"
*		stream.is-live = "true"
*		node.name = "SoX"
*		media.class = "Stream/Output/Audio"

Last edited by jerryDaBaaws (2024-12-19 09:34:27)

Offline

#7 2024-12-21 03:46:24

jerryDaBaaws
Member
Registered: 2020-06-08
Posts: 108

Re: Wireplumber set media role on a sink stream [SOLVED]

for anyone looking to do the same, i managed to do it via pw-play

 pw-play --media-role "Notification" $file

Offline

Board footer

Powered by FluxBB