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 have an external sound card which mostly works fine, except that when its first plugged in, or when I turn on my laptop, the volume gets set to 100%. That is, the overall system volume, as shown in the sound indicator.

What I'm looking for is a terminal command that will set that volume to 50%, so that I can run it on login and not have to worry that the first audio I play is going to blare out at me if I forget to turn the volume down. What commands allow you to change that volume, i.e. the one in the sound indicator?

I've poked around in gsettings and dbus, but have been unable to find anything that would let me set the system volume like that. I do know about alsamixer, but that's not the solution I'm looking for, since that doesn't allow me to change the volume using the sound indicator or my laptop's multimedia keys.

share|improve this question
    
@rajagenupula he wants to decrease the same volume as the GUI. ALSA wouldn't work in this case as it's not controled by ALSA but Pulseaudio. i.stack.imgur.com/9C8Z2.png –  Braiam Nov 22 '13 at 13:41
    
Also see here: askubuntu.com/questions/44680/… –  Takkat Nov 22 '13 at 14:16

3 Answers 3

Parts of this answer comes from setting audio input via cmd line?, placed here for your convenience.

Increase volume by 5%

amixer -D pulse sset Master 5%+

Decrease volume by 5%

amixer -D pulse sset Master 5%-

Set volume to 50%

amixer -D pulse sset Master 50%

If you are using ALSA, amixer can be helpful for your script programming.

When dropping the amixer --help command in a terminal you will see something like this:

enter image description here

Depending on your soundcard, levels may be different than mine, but you can use alsamixer in the terminal in order to check which levels and which features in your sound card you can call in a command to set the volume as you wish.

enter image description here

In my example, with my principal sound card (I have 2: the embedded and a PCI audio card), levels are from 0 to 100, this way I can change the volume of a desired input/output in my soundcard by dropping in a terminal the next command:

amixer -c 0 set Front 50DB 
amixer -c 0 set Front 64DB 

In the first command, the result will set the Front panel output to 78% level and the second one will set the Front panel output to 100% level.

In order to gather information related to your mixer controls, drop the amixer command with no parameters and you will get a list. Or indicate which audio device you wish to see a list of controls with amixer -c X (where "X" is the number of your audio device).

BTW: Remember that DB values are calculated logarithmically and not linearly.

Remember that this command allow you to control parameters on whatever sound device you are currently using.

Good luck!

share|improve this answer

You can do it using PulseAudio itself (I won't recommend using ALSA because then you can't use the GUI to bring the volume up/down). If you have only one soundcard you may use pactl:

pactl set-sink-volume 0 +10%

This makes the volume 10% up. If you want it 10% down:

pactl set-sink-volume 0 -- -10%

(the manual page says the -- isn't necessary but it recognize -10% as a parameter)

If you need the volume at 50%:

pactl set-sink-volume 0 50%

If you need to rock the entire place:

pactl set-sink-volume 0 150%

You can use percents or integers, but the integers are slow and may not be your thing.

share|improve this answer
    
If you're using headphones, try increasing the zero to one: pactl set-sink-volume 1 50% –  Smile4ever Nov 1 at 12:09

amixer set 'Master' 10%+ - to increase max sound 10%

amixer set 'Master' 10%- - to decrease max sound 10%

amixer set 'Master' 10% - to get 10% of the max sound

amixer set 'Master' 80% - to get 80% of the max sound

.. etc.

If you want to set the volume to other than 'Master', check the list by:

amixer scontrols


You may also want to check out alsamixer and pacmd

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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