danieljon.es

index posts opinions portfolio

Posts

My posts about programming and things.
Date format is day/month/year because I'm sane.

Mute music while something else plays audio

1/12/2019

I wanted to mute my music when another application (mpv or browser) started playing an audio stream and unmute the music when that stream ended. To do this I had a look at the pulseaudio API and started investigating how I could go about doing this. Quickly someone pointed me to the modules page on the pulseaudio wiki, specifically the role ducking module.

"This module lowers the volume of less important streams when a more important stream appears, and raises the volume back up once the important stream has finished (this is called "ducking")."

This is exactly what I wanted. Programs run with their media.role set to "browser" will make anything run with the media.role of "music" mute themselves. Implementing it into my environment was straight forward:



RSS feed
FSF member

page generated 10/4/2023 using websitegenerator in C