<div dir="ltr"><div>Hi Georg,</div><div><br></div><div>Thank you so much for that fast reply!</div><div>It helped me find the solution I was looking for :)</div><div><br></div><div>For completeness, here's what I found and how this can work.</div><div><br></div><div>First module-role-cork. It turns out I had that one active already. All it needed was roles to be passed to applications which can be done like [1].</div><div>Once I passed those roles the corking effect was immediately clear when starting the media with the "phone" role.</div><div>Downside in my case of cork is that it completely mutes the other (music in this case) which is a bit sudden.</div><div><br></div><div>Module-role-ducking on the other hand is exactly what i'm looking for!</div><div>I removed module-role-cork and loaded module-role-ducking with these settings:</div><div>load-module module-role-ducking trigger_roles=phone ducking_roles=music,video volume=60%<br></div><div>Next (pulseaudio restart in between) I just played [1] again.</div><div>Now the music stream is lowered in volume while the phone stream has audio to output.</div><div><br></div><div>While this works, it's still a bit rough.</div><div>In my case the "phone" stream is the mpv media player. As long as it just plays something it works as-described. If you however start seeking forward/backward in that "phone" stream then - the fraction of time you seek and have no sound - ducking resumes the volume level of "music" to what it was. So if you do a lot of seeking you have a lot of volume jumps which sounds very weird. It would be great if ducking would wait for a second or so before resuming volume. A bonus feature would be if ducking would fade in and out over - say - 300ms.</div><div><br></div><div>Anyhow, this is already very usable to me! Thank you so much for pointing me in the right direction Georg, that's much appreciated!</div><div><br></div><div>[1] just start 2 media players with different roles:<br>PULSE_PROP='media.role=music' mpv <media to play><br></div><div>PULSE_PROP='media.role=phone' mpv <media to play><br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 4, 2024 at 12:08 PM Georg Chini <<a href="mailto:georg@chini.tk">georg@chini.tk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Mark,<br>
<br>
there are module-role-cork and module-role-ducking which provide the <br>
kind of functionality<br>
you are looking for. If you have a stream with "role1" assigned, which <br>
should duck all other<br>
streams, the command would be something like<br>
<br>
pactl load-module module-role-ducking trigger_roles="role1" <br>
ducking_roles="any_role" global=1<br>
<br>
The grouping of roles works for both, module-role-cork and <br>
module-role-ducking even though<br>
it is only mentioned in the description of module-role-ducking.<br>
(pacmd describe-module module-role-ducking) You can use the special <br>
roles "any_role" to specify<br>
all streams and "no_role" for those streams that do not have a role <br>
assigned.<br>
<br>
The main problem is to make sure that your (trigger) streams always have <br>
the correct role,<br>
so you have to set the media.role property somehow.<br>
<br>
Regards<br>
Georg<br>
<br>
On 04.05.24 10:27, Mark Gaiser wrote:<br>
> Hi,<br>
><br>
> Let me first try to describe what I'm trying to do. Perhaps there is <br>
> an existing solution for this already that I haven't found yet.<br>
><br>
> This is mostly for home automation purposes. Imagine you have a DIY <br>
> speaker with a raspberry pi. You use it to play music on. Perhaps even <br>
> with a higher quality DAC. The gist is that you have a linux-based <br>
> speaker that uses pulseaudio for playback.<br>
><br>
> Now you want to send an audio notification. What you would want to do is:<br>
> - Whatever is currently playing, lower it's volume<br>
> - Play the notification at a louder volume<br>
> - Resume to whatever was playing at whatever volume it was<br>
><br>
> Are there any ways that one can achieve the above with the current <br>
> pulseaudio version?<br>
><br>
> The following is a brainstorm! What I'm thinking is if it would be <br>
> possible to make a pulseaudio module that registers its own dedicated <br>
> sink. When audio is being sent to that sink then it would lower the <br>
> volume on the other sinks. When no more audio is sent the other sinks <br>
> get restored to whatever their level was. Audio played on this <br>
> "notification sink" is boosted a little. All these options should be <br>
> configurable. Would such a plugin even be possible in pulseaudio? I <br>
> guess I'm asking if a plugin has the capabilities to modify the output <br>
> of other sinks?<br>
><br>
> I'm looking forward to what you folks think.<br>
> Hopefully it's all already possible :) That sure is a million times <br>
> easier!<br>
><br>
> Best regards,<br>
> Mark<br>
><br>
</blockquote></div></div>