You are not logged in.

#1 2021-04-03 07:44:28

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

Notification alert sound [SOLVED]

I am using dunst for notifications, and to get a alert, I use paplay to play a sound from a bash script

Problem is that when you are playing another media at high volume, notif sound gets completely lost in it. I don't want to set it too high because often I switch between bluetooth speaker and headphone and getting a alert sound at high volume in later is painful.

Is there a way to dim sound levels from other sources before playing notification sound and restore them immediately/slowly after ?

Last edited by jerryDaBaaws (2021-04-03 11:40:59)

Offline

#2 2021-04-03 10:30:58

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,342

Re: Notification alert sound [SOLVED]

Pulseaudio has module-role-ducking for this purpose, however that relies on the media.role  property to be set which it might not be depending on the clients you are using and I don't find anything on how that would be enabled globally. going through the source I might've found something for the no role case but there's still not a just apply to all case but that should cover most of what you will encounter.

It should be trivial enough to set a unique trigger role for your paplay invocation, so your ducking line would look something like

#Should cover most, but you could just add roles to the list if you encounter more, I don't think there's a "everything" wildcard
load-module module-role-ducking trigger_roles=notification ducking_roles=no_role,music,video,audio volume=-20dB

and the relevant paplay invocation

paplay --property=media.role=notification $FILE

Offline

#3 2021-04-03 11:40:39

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

Re: Notification alert sound [SOLVED]

thanks, this works exactly as I wanted

Offline

Board footer

Powered by FluxBB