I need to allow several clients to affect the volume of a central server.
Can I change the audio master volume via command line in Ubuntu 12.04?
pactl -h
I just tried parameters like
pactl set-sink-volume 0 12000
To mute
pactl set-sink-mute 0 1
Type alsamixer
:
This can be used to adjust both input and output volume levels.
Edit: As you seem to be displeased at my simple solution, I will add this:
Create a file in the home directory called volume
:
gedit ~/volume
Then add these lines to it:
#!/bin/sh
if [ "$1" = "down" ]; then
amixer set Master playback 5-;
echo "";
echo "Turned volume down a bit";
elif [ "$1" = "mute" ]; then
amixer set Master playback 0%;
echo "";
echo "Muted";
else
amixer set Master playback 5+;
echo "";
echo "Turned volume up a bit";
fi
exit
Save and exit, then run this to make it executable:
chmod +x ~/volume
You should then be able to control it with:
~/volume
, ~/volume up
, ~/volume anything you like
- turn the volume up~/volume down
- turn the volume down~/volume mute
- muteThis will needed to be to added to the home directory of each user, unless...
sudo mv ~/volume /usr/bin/volume
This will add the script file to the /usr/bin
directory, which means it can be executed with just this, by every user on the system:
volume
and the command line options will still work, for example:
volume down
Note: For those thinking you can create and alias with is, it seems you can't as it does not tolerate command line options, so will only urn the volume up (in this script anyway)
alsamixer
, then using the arrow keys, it much similar and more intuitive. Though I have had an idea...
– Wilf
Jan 14 '14 at 17:28