You are not logged in.

#1 2023-01-15 13:29:27

kocheng
Member
Registered: 2022-10-22
Posts: 22

Can I set PulseAudio max volume?

Apparently, by default PulseAudio would allow me to set the volume higher than 100%. I'm afraid that if the volume accidentally go up to some insane value that it would broke my speaker. How can I set a maximum possible volume for PulseAudio (possibly with a configuration file)?


Sorry if my English is bad.
Oh, and PLEASE remind me if I had accidentally post something sensitive...

Offline

#2 2023-01-15 13:40:27

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,052

Re: Can I set PulseAudio max volume?

You can't for the server as a whole but there are volume adjustment clients you can configure their max in, e.g. pulsemixer

In any case this should not be able to damage your speakers

Offline

#3 2023-01-15 13:49:48

progandy
Member
Registered: 2012-05-17
Posts: 5,304

Re: Can I set PulseAudio max volume?

You sound card has a physical limit on what it can provide, Generally that should be safe for speakers I think. If you crank the volume up too high, the sections that are too loud will be clipped.

Last edited by progandy (2023-01-15 13:50:20)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#4 2023-01-15 15:17:19

kocheng
Member
Registered: 2022-10-22
Posts: 22

Re: Can I set PulseAudio max volume?

Yeah days ago my ignorant friend would raise up the speaker (laptop's built-in) to a very high level. Right now I use external usb speaker because the laptop's speaker sound became very low, raising it to some level just make the sound distorted sad


Sorry if my English is bad.
Oh, and PLEASE remind me if I had accidentally post something sensitive...

Offline

#5 2023-01-15 15:45:46

progandy
Member
Registered: 2012-05-17
Posts: 5,304

Re: Can I set PulseAudio max volume?

If you use pipewire it looks like you can set a volume limit. I do not know how that maps to the pulseaudio percentage scale.
https://gitlab.freedesktop.org/pipewire … ssues/1372
https://forum.manjaro.org/t/pipewire-co … lume/59380

Last edited by progandy (2023-01-15 15:48:43)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#6 2023-01-16 17:07:33

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,052

Re: Can I set PulseAudio max volume?

this logic is leveraged from pulse directly you could do the same workaround on pulse but this will afaik simply limit by how far the underlying ALSA control is adjusted and would still allow the "normal" pulse sink volume to be increased past this point.

Offline

#7 2023-01-18 00:19:51

kocheng
Member
Registered: 2022-10-22
Posts: 22

Re: Can I set PulseAudio max volume?

OK after searching for a while I use a bash script found here. Works tbh.

#!/bin/sh

max_volume=100 # in percent

pactl subscribe \
| grep --line-buffered 'sink ' \
| stdbuf -o0 cut -d# -f2 \
| while read index; do
    volume=$(pactl get-sink-volume $index | head -n1 | cut -d/ -f2 | tr -d ' %');
    if (( volume > max_volume )); then
        pactl set-sink-volume $index $max_volume%;
    fi;
done

What do you think?


Sorry if my English is bad.
Oh, and PLEASE remind me if I had accidentally post something sensitive...

Offline

Board footer

Powered by FluxBB