On Tue, 31 Jan 2023 23:29:55 +0100 (CET) funk443--- via <[email protected]> wrote:
> Currently volume adjustment of EMMS can only adjust master volume, > which will bring some inconvenience while someone was trying to have > some music via EMMS in the background while doing other stuffs that > also plays sound (e.g. playing games, talking to others...). > So I wrote some functions to adjust the volume of MPV player only, > and please correct me if I am doing something wrong. i think "volume" in mpv normally works this way: - It is a "software volume", i.e. changes values of the samples sent to an audio API like PulseAudio or Pipewire. - Starts at 100, meaning no boost or reduction. - Going lower than 100 works mostly as expected - reduces volume in a sensible fashion. - But going above 100 makes audio samples already close to max value all "smush together" which I think is usually called "clipping" in audio - information about actual sound gets lost. Last part is something you might want to always avoid for stuff like music, so this way of setting the volume is kinda limiting - allows to adjust volume down, but not up without sound quality loss. But modern audio APIs on linux also support per-application volumes, which don't have such issues, as volume there doesn't start at 100%. (and "100%" tends to mean "max possible volume from audio card", which rarely needs to be that high) You can also control that volume instead via "ao-volume" parameter, which would allow raising volume without any quality loss and in way where it's not hidden within mpv process, but that you can also control from OS/DE-level mixer apps (e.g. pavucontrol that comes with pulse, or its pipewire counterpart). So thought to mention it as a potentially better alternative parameter to tweak, if mpv makes "ao-volume" property available (i.e. knows how to control current audio output's volume). Though of course it might depend on the specific environment and setup. "volume" should be more universal, even if a bit limited like that. -- Mike Kazantsev // fraggod.net
