1

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?

  • 1
    Have you tried ponymix? – earthmeLon Mar 8 '16 at 17:40
  • The alsamixer command is also useful. – muru Mar 8 '16 at 17:49
  • @earthmeLon Thanks for the advice. It's proving useful, seems like a good tool. – the_naive Mar 9 '16 at 13:41
0

Try alsamixer. In alsamixer, you can individually set the volumes for the different input and output devices.

0

To change a PulseAudio mixer control, you need to use -D pulse.

To change an ALSA mixer control, you need to use -c x, where x is the card number or ID. (The ID is shown in square brackets in /proc/asound/cards.)

To see a list of controls, use amixer -c x scontrols.

0

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.

  • Can you share HOW you solved the problem? – Marc Feb 3 '17 at 4:51
  • @Marc Hi, sorry for the delay. I have updated my answer. Hope it helps you. – the_naive Feb 8 '17 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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