Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

marked as duplicate by Avinash Raj, guntbert, Radu Rădeanu, karel, Eric Carvalho Jan 14 at 1:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Do you expect them to do that concurrently? –  guntbert Jan 13 at 21:04

3 Answers 3

pactl -h

I just tried parameters like

pactl set-sink-volume 0 12000

To mute

pactl set-sink-mute 0 1
share|improve this answer

Amixer is a great tool..

amixer set Master playback 5+

or

amixer set Master playback 5-
share|improve this answer

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 - mute

This 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)

share|improve this answer
    
that brings up a mixer, not affects the volume directly –  Mild Fuzz Jan 13 at 11:05
    
Still works, @MildFuzz ;-) –  Wilf Jan 13 at 11:15
    
not in the way I asked –  Mild Fuzz Jan 14 at 13:08
1  
Well, I thought that you do get the commands that others have suggested as answers, but they are faitly long and annoying - whereas using alsamixer, then using the arrow keys, it much similar and more intuitive. Though I have had an idea... –  Wilf Jan 14 at 17:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.