Setting volume from cli
The command:
amixer -q -D pulse sset Master 30%
is one I found always working so far. To completely dim:
amixer -q -D pulse sset Master off
Switch back on:
amixer -q -D pulse sset Master on
Setting volume per application
Not sure if you want different sound volumes for different applications at the same time, or you'd like to set the volume, depending on what application is in front.
If the latter is the case, take a look here. It includes a script, dimming sound depending on the active window. Can easily be made to set a specific volume.
To find more information on how to do it per application at the same time see the answers to this question, as provided by @muru.
set-sink-input-volume
instead ofset-sink-input-mute
in that script. See thepactl
manpage for more info. – muru Nov 17 '16 at 15:19