Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to control the volume using my programming script. How can I do the following in Fedora 15, Ubuntu linux?

  1. Mute/ Unmute
  2. Volume up and volume down

Note: Please note that I use a web USB microphone/speaker and also Analogue microphone/speaker. I want to apply to all to be sure.

share|improve this question
add comment

1 Answer

up vote 14 down vote accepted

You can use amixer. It's in the alsa-utils package on ubuntu/debian.

Run it without parameters to get an overview about your devices.

amixer

Then use the set command to set the volumn. For example to set the master channel to 50%:

amixer set Master 50
share|improve this answer
3  
Thanks! there are two ways to do this 1. As your excellent example: amixer set Master mute; amixer set Master unmute; 2. yum -y install xdotool; xdotool key XF86AudioRaiseVolume; xdotool key XF86AudioLowerVolume; –  YumYumYum Sep 20 '11 at 11:05
    
@89899.3K Thanks for the info, xdotool looks interesting. –  Dario Sep 20 '11 at 11:14
2  
And as an addition, you can increase or decrease the volume by amixer set Master 10%+ and amixer set Master 10%- –  user Apr 7 '12 at 21:25
    
This does not work in Ubuntu. –  Cerin May 24 '12 at 14:37
    
1. Use option -M for intuitive numbers 2. Maybe Ubutu uses PulseAudio 3. Ubuntu su*** –  ManuelSchneid3r Aug 9 '13 at 12:39
show 1 more comment

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.