Unable to adjust volume on Linux

I ran across this on a recent Ubuntu and couldn’t find anything here about it, so I thought I would add this since I finally figure it out.

I was completely unable to adjust the receive volume on Linux using alsamixer. The setting or mute made no difference. And yes, I had cut the attenuator trace.

It turns out that there are two volume controls on the microphone and alsa was only showing me one of them. One is for playback (which I assume is fed back to the output) and that’s the one it was showing me, which obviously would do no good. The other was the capture, which is the one that we want. To demonstrate, here is the output of amixer:

cminyard@t560:~$ amixer -c 1
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 151
  Mono:
  Front Left: Playback 95 [63%] [-10.56dB] [on]
  Front Right: Playback 95 [63%] [-10.56dB] [on]
Simple mixer control 'Mic',0
  Capabilities: pvolume pvolume-joined cvolume cvolume-joined pswitch pswitch-joined cswitch cswitch-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: Playback 0 - 127 Capture 0 - 16
  Mono: Playback 0 [0%] [0.00dB] [off] Capture 8 [50%] [11.90dB] [on]
Simple mixer control 'Auto Gain Control',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]

See how the mixer control ‘Mic’,0 has a Playback and a Capture setting? That’s the issue. I was able to set the volume with “pavucontrol”. You can set it with amixer, too, but it’s a bit more complicated. It’s not a “simple” control, according to ALSA, and that’s why alsamixer isn’t showing it. But to set it with amixer, first dump the info:

cminyard@t560:~$ amixer -c 1 controls
numid=3,iface=MIXER,name='Mic Playback Switch'
numid=4,iface=MIXER,name='Mic Playback Volume'
numid=7,iface=MIXER,name='Mic Capture Switch'
numid=8,iface=MIXER,name='Mic Capture Volume'
numid=9,iface=MIXER,name='Auto Gain Control'
numid=5,iface=MIXER,name='Speaker Playback Switch'
numid=6,iface=MIXER,name='Speaker Playback Volume'
numid=2,iface=PCM,name='Capture Channel Map'
numid=1,iface=PCM,name='Playback Channel Map'

We want “Mic Capture Volume”. The interface is hard to figure out from the docs, but to get just the mic volume use:

cminyard@t560:~$ amixer -c 1 cget iface=MIXER,name='Mic Capture Volume'
numid=8,iface=MIXER,name='Mic Capture Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=0,max=16,step=0
  : values=8
  | dBminmax-min=0.00dB,max=23.81dB

The “values” field is the current setting, “min” and “max” are the ranges it can be, so it takes 17 possible volumes. If we want to change it to “10”:

cminyard@t560:~$ amixer -c 1 cset iface=MIXER,name='Mic Capture Volume' 10
numid=8,iface=MIXER,name='Mic Capture Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=0,max=16,step=0
  : values=10
  | dBminmax-min=0.00dB,max=23.81dB

The “Mic Capture Switch” may also need to be set, it’s the “unmute” (it must be set to “on” to work) switch. And you probably want “Mic Playback Switch” set to “off”, as you don’t want received sound playing back to the output.

1 Like