How to mute, unmute and set all output and input audio devices to full volume from command line in ubuntu?

8,106

I solved the problem using pacmd.

For example, the following command produces the list of devices that work as audio inputs:

pacmd list-sources|awk '/index:/ {print $0}; /name:/ {print $0};'

The output for the command in my system is a below:

    index: 0
    name: <alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor>
    index: 1
    name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
  * index: 2
    name: <alsa_input.pci-0000_00_1b.0.analog-stereo>

The * indicates that this input device is used as the default currently.

The following command changes the volume of the device alsa_input.pci-0000_00_1b.0.analog-stereo.

pacmd set-source-volume alsa_input.pci-0000_00_1b.0.analog-stereo 50000

You can also put the index number instead of the device name as the following one:

pacmd set-source-volume 2 50000

Here I used 50000 as the volume value because normally 100000 is maximum value.

Please look at the pacmd manual for more command related information.

Share:
8,106

Related videos on Youtube

the_naive
Author by

the_naive

Updated on September 18, 2022

Comments

  • the_naive
    the_naive over 1 year

    I have seen many questions throughout online, but I could only set the volumes of input and output audio devices that are selected as default in the sound settings of Ubuntu system.

    These commands are as below:

    amixer -D pulse sset Master mute
    amixer -D pulse sset Master unmute
    amixer -D pulse sset Master x%
    amixer -D pulse sset Capture x%
    

    No other command works at all. For example, using this instruction, I tried the command:

    amixer -c 3 -- set Master playback -20dB
    

    only to get replied:

    amixer: Unable to find simple control 'Master',0
    

    I have several input and output devices connected to my ubuntu system and I want to control the volume of all the devices from command line. Is that possible? How is it possible from command line to set the volume of the devices that are not selected as the default in the ubuntu audio settings?

    • earthmeLon
      earthmeLon about 8 years
      Have you tried ponymix?
    • the_naive
      the_naive about 8 years
      @earthmeLon Thanks for the advice. It's proving useful, seems like a good tool.
  • Marc
    Marc about 7 years
    Can you share HOW you solved the problem?
  • the_naive
    the_naive about 7 years
    @Marc Hi, sorry for the delay. I have updated my answer. Hope it helps you.