I sometimes play games and also open my music player, but the sound from the game drowns out the music, so I need to go into the sound mixer on KDE and manually lower the game’s volume every time.
I was wondering, is there a way to do this process automatically? As in setting up conditions like “if music is playing (some MPRIS API?) then lower all other apps’ volumes)”, maybe even crazier “if some app is outputting voice then set its volume back up and lower music app’s volume or pause its playback altogether for some specified timeout that keeps being refreshed for as long as voice is heard”.
I imagine the latter is a bit of a dream, but maybe for the first, even some quick sound profile selector would go a long way, say switching from “normal profile” to “background music profile”, etc. which specify preconfigured volumes for those apps.
Is that a thing?

7 points

The details depend a bit on the audiostack of your distro, but they all have a cli program with which you can change inputs/outputs and volume; e.g. pactl for pulseaudio and wpctl for wireplumber.

You’ll need a mechanism to find your triggers (I create a firefox tab with youtube/spotify, I have a music player active) and then you can act on it.

Detecting voice in an audiostream is probably technically possible, but that sounds pretty hard to setup.

permalink
report
reply
1 point
*

So what I’m getting is that I would have to come up with something myself, right? I mean that would be super cool to do, but I don’t have the time to put into that, unfortunately

permalink
report
parent
reply
1 point

Yes, a quick web search later I haven’t found a readymade solution.

Setting the volume for specific outputs is not very hard, so maybe a middleground solution is to have two shortcuts. One for “game mode” and one for “music mode” or whatever.

permalink
report
parent
reply
4 points
*

Pulseaudio should have hooks

# cat /etc/pulse/default.pa
load-module module-switch-on-connect
load-module module-exec
load-module module-exec arguments="path/to/your/script.sh %s"    

(where %s resolves on trigger to the name of the sink added)

Your script.sh should then match the first argument to the name of the sink you want to control, and then run

# path/to/your/script.sh
if [ "$1" = "THESINKIWANT" ]; then
  pactl set-sink-volume $1 40%
fi
permalink
report
reply
4 points

There is a great video on that in German

https://www.youtube.com/watch?v=I7KzeHtS0Kc

permalink
report
reply
2 points

55 minutes? Uhm, could you tell me the relevant section of the video, please?

permalink
report
parent
reply
2 points

No not really

permalink
report
parent
reply
4 points
*

Why so irritable? I’m just asking, I don’t even know German, I thought since you knew the video already, you could point me in the right direction, rather than me having to sift through it all while also passing it through a translator to hopefully (because I don’t know how well youtube’s auto-translate feature works) find the information I’m looking for in the whole presentation

permalink
report
parent
reply
2 points

this is high level trolling, kudos sir

permalink
report
parent
reply
3 points

I’m fairly sure you can do this with Wireplumber hooks. https://pipewire.pages.freedesktop.org/wireplumber/design/events_and_hooks.html

permalink
report
reply
3 points
*

This is the architecture though, I’m asking about an application that can interact with it

permalink
report
parent
reply
2 points
*

I found this software a couple of days ago. Not sure if it will really help with your first problem 😆 because I’m still figuring it out myself. But looks promising. https://github.com/wwmm/easyeffects

permalink
report
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 8K

    Monthly active users

  • 3.7K

    Posts

  • 48K

    Comments