31

Somtimes some sound/movie/music on my Ubuntu_12.04 system is at a very low volume by itself. Henceforth I increase the volume of the sound output. I can use the following setting (see screenshot) enter image description here

It seems therefore that pulseaudio is able to increase the volume beyond the maximum that appears possible by merely using the "increase-volume" buttons of the machine. My questions is how I can adjust Pulseaudio to allow a greater range or a higher max volume increasing???

Especially with some audio material that is at a very low volume to start with it would be nice to be able to swiftly increase the output volume (powerup) to a higher setting than maybe necessary to other -already quite loud- material.

6 Answers 6

32

The maximal possible volume level we can obtain from sliding the volume control to more than 100% is approx. 153% above the normal peak limit. Provided we had set the ALSA volume with alsamixer to 100 these 100% are the level above which audio will be clipped or distorted. This also will happen when amplifying to 153% with the slider.

Nevertheless is is possible to further increase this level by setting the sink level using the follwing command in a terminal:

pacmd set-sink-volume <sink> <value>

Replace <sink> with your sink name or sink index as given from:

pacmd list-sinks

The lower limit for <value> obviously is 0, a linear volume of 100% is a value of 65536, anything higher will be further amplified. A value of 512000 will thus lead to an overamplification of 781%.

This is a very crude method to amplify sound output of varying level as overamplifying will lead not only to clipping and ugly distortion but may also damage your speakers.

Therefore it would be a better way to normalize your audio output. See the following question on how to do this with pulseaudio:

7
  • I have used pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo 150% - since I could not succeed yet with pacmd. Anyhow the idea already helped a lot. In this way it is possible to increase the output level to more than the 100% or 153% which the GUI allows, thank you. Nov 21, 2012 at 6:19
  • 2
    Your great answer allowed to set the volume to greater values (like 781% amplification) which is great. Part of my question is also how to change the scale originally used so that it is not from 0% to 100% (via GUI) but from 0% to 781%. Any additional infor how to achieve this, maybe? it would be additionally great! thank you Nov 21, 2012 at 6:23
  • No idea how to increase this value for the volume slider. It may be hard-coded, hence cant be changed other than patching the source and recompiling.
    – Takkat
    Nov 21, 2012 at 7:11
  • 2
    Does not work: A program can still make it 100% even if I set it to 12% that way.
    – panzi
    Jun 27, 2016 at 19:13
  • I had my laptop speakers destroyed by using the volume at the 150% also allows. I had to replace them. Be advised that the possible damage warning is justified.
    – brett
    Aug 1, 2019 at 8:39
9

I tried this command:

pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo 150%

and it was very helpful. One can change the 150% to any value.

2
  • 1
    You should mention that it disables volume control.
    – Green
    Feb 18, 2018 at 15:00
  • IT WORKS!!! If you want to do this and you use Pipewire, you can get the sink id with "pactl list sinks" and then you can use the command above without problems.
    – Allexj
    Mar 2, 2022 at 14:17
5

Video Demonstration


I use

pactl set-sink-volume 0 100%

Where 100% is the default unboosted volume and 0 is the Sink # from pacmd list-sinks or the index: from pactl list sinks (if you don't have/like pacmd). You can enter values above 100% to get audio boost (200% for example).

Example of retrieving your Sink number/index:

$ pactl list sinks | grep -iE '(^sink|name:|index:|alsa\.(name|card_name))'
Sink #3
    Name: alsa_output.usb-0c76_USB_PnP_Audio_Device-00.analog-stereo
        alsa.name = "USB Audio"
        alsa.card_name = "USB PnP Audio Device"
Sink #4
    Name: alsa_output.pci-0000_00_1f.3.analog-stereo
        alsa.name = "ALC257 Analog"
        alsa.card_name = "HDA Intel PCH"
$ pacmd list-sinks | grep -iE '(^sink|name:|index:|alsa\.(name|card_name))'
  * index: 3
    name: <alsa_output.usb-0c76_USB_PnP_Audio_Device-00.analog-stereo>
        alsa.name = "USB Audio"
        alsa.card_name = "USB PnP Audio Device"
    index: 4
    name: <alsa_output.pci-0000_00_1f.3.analog-stereo>
        alsa.name = "ALC257 Analog"
        alsa.card_name = "HDA Intel PCH"
3
  • it disables volume control.
    – Green
    Feb 18, 2018 at 15:00
  • why? no it doesn't. I just tried it and it's fine. The thing is that it raises the volume above the maximum volume that the volume bar can reach. A full bar would probably be about 150% maybe, so 200% cannot be done with the bar. @Green
    – 842Mono
    Feb 21, 2018 at 12:42
  • 1
    IT WORKS!!! If you want to do this and you use Pipewire, you can get the sink number with "pactl list sinks" and then you can use the command above without problems.
    – Allexj
    Mar 2, 2022 at 14:16
2

Here is a little script to do the calculation and set volume for you (just pass the volume as an argument). For example: vol 105 will set the volume to 105%.

  • Create file

    $> file=/usr/bin/vol;sudo touch $file && \
    sudo chmod u+x $file && sudo chown $USER:$USER $file && \
    gedit $file
    
  • Copy and paste:

    #!/bin/bash
    SetPacmdSinkVol()
    {
        #default index of 0 - can be changed
        local mySinkIndex=0
        #if you want to ignore pacmd output
        local ignoreOutput=true
        local num=$1
        local vol=$((num * 655)); 
        vol=$((num * 36 / 100 + vol));
        echo -e "\033[0;32mVol - ${num}:${vol}\033[0;m"
        if $ignoreOutput; then
            pacmd set-sink-volume $mySinkIndex $vol > /dev/null
        else
            pacmd set-sink-volume $mySinkIndex $vol
        fi
    }
    SetPacmdSinkVol $@
    
1

I inserted the following line into a shell script and set it to run at startup since my fathers laptop (12.04 32 bit) was not saving the max volume setting.

pacmd set-sink-volume 0 99999

if there is only one sound card it is probably index 0 and then you don't need to type out the full name. I see above that the value is based on 65536 being 100%. When I used 99999 i was shooting in the dark. 153% would actually be 100270 achieving the same result as using the gui.

1
  • You can probably just state "153%" instead of 100270. I use "+5%" and "-5%" in keybinds
    – sehe
    2 days ago
1
#!/bin/bash

FILE=/tmp/currentVolume

interval=15
minVolume=10
maxVolume=140

if [ -f "$FILE" ];
then
   CurrentVolume=$(cat $FILE )
else
   CurrentVolume=50
fi

        if [ $CurrentVolume -lt 60 ]; then
            interval=3
        elif [ $CurrentVolume -lt 80 ]; then
            interval=5
        elif [ $CurrentVolume -lt 110 ]; then
            interval=10
        else
            interval=15
        fi

if [ "$1" == "UP" ] 
then
    CurrentVolume=$(echo "$CurrentVolume + $interval" | bc)
    if (( $(echo "$maxVolume < $CurrentVolume" | bc -l) ))
    then
        CurrentVolume=$maxVolume
    fi  
else
    CurrentVolume=$(echo "$CurrentVolume - $interval" | bc)
    if (( $(echo "$minVolume > $CurrentVolume" | bc -l) ))
    then
        CurrentVolume=$minVolume
    fi
fi

echo "CurrentVolume:" $CurrentVolume >> /tmp/currentVolume.log
echo $CurrentVolume > $FILE


for i in {1..20}
do
   pactl -- set-sink-volume $i $(echo $CurrentVolume)%
done
1
  • 2
    Thank you for your answer. If possible, could you edit your answer to elaborate a bit more about it? It's always helpful for people to know why a solution is supposed to work, instead of just blindly copy'n'pasting code they don't understand. That also helps to adapt solutions to different problems. Nov 19, 2016 at 11:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .