I want an instruction suitable for any application. It may be an XY problem, but I have many apps that need this feature. An example is Radiotray-ng, browsers normally don't have a volume setting, I also have a Wine program for cuckoo clock, it doesn't have any homepage or something, so I can't give a link to it. May be this should be implemented on app level, but an app may be buggy or may lack this setting, so I think it would be a good feature for a sound server.
I'm now using Ubuntu, but I'm going to install a new distro. But it doesn't matter, it's not a distro-specific question. I don't have a requirement to use a certain distro. I don't even have a requirement to use Pulseaudio. If you know how to do it in Pipewire or in any combination of software, please give me the instruction.
It sounds like you want the volume of an app that has sound to retain the volume setting that you set for the next time that you run it.
Perhaps see what pulseaudio modules you have running. For example running the following command, may show the module that appears to do what you are concerned about. The output is large so I have snipped it to just show the relevant module:
Code:
$ pactl list modules
<snip>
Module #536870914
Name: module-device-restore
Argument:
Usage counter: n/a
Properties:
module.author = "Wim Taymans <[email protected]>"
module.description = "Automatically restore the volume/mute state of devices"
module.usage = "restore_port=<Save/restore port?> restore_volume=<Save/restore volumes?> restore_muted=<Save/restore muted states?> restore_formats=<Save/restore saved formats?>"
module.version = "1.2.4"
<snip>
As the description helpfully indicates, this module function is to "Automatically restore the volume/mute status of devices", which seems to be exactly your concern.
One possible way of dealing with this issue is to unload this module that is restoring the volume.
Code:
pactl unload-module module-device-restore
That may work. To make it persistent for the user, a possible approach is to set a configuration in:
/home/$USER/.config/pulse/default.pa
with the following contents:
Code:
load-module module-device-restore restore_volume=false
For system-wide application of the config, use: /etc/pulse/default.pa.
Please bear in mind that configurations like this can take some "trial and error" application to get just what you want, and the above is a proposal which may or may not work without some modifications. In my own case, the machines here are all pipewire now, so the info supplied here may need amendment if things have been updated for pulseaudio which was the former sound server here when these sorts of configs were made. In any case, there does appear to be the means to achieve your aim. Some relevant manpages are:
man pulse-client.conf
man default.pa
man pulse-cli-syntax
Information on pulseaudio modules is here:
Some details and examples are here, but not exactly the issue at hand:
wiki.archlinux.org