1

There are two output devices : headphone and line out in my pc.I can select one of them as output decice with the PulseAudio Volume Control.Can amixer do the same job such as pulseaudio?

I want to select speaker on card 1 to play audio.

amixer -c 1 set "speaker" On 
amixer: Unable to find simple control 'speaker',0    
amixer -c 1 set "speaker" 10db
amixer: Unable to find simple control 'speaker',0

Both of them can't work.

@MC68020,Invalid command:

debian@debian:~$   amixer -c 1 scontrols
Simple mixer control 'Master',0
Simple mixer control 'Headphone',0
Simple mixer control 'Headphone+LO',0
Simple mixer control 'PCM',0
Simple mixer control 'Front',0
Simple mixer control 'Front Mic',0
Simple mixer control 'Front Mic Boost',0
Simple mixer control 'Surround',0
Simple mixer control 'Center',0
Simple mixer control 'LFE',0
Simple mixer control 'Line',0
Simple mixer control 'Line Boost',0
Simple mixer control 'IEC958',0
Simple mixer control 'IEC958 Default PCM',0
Simple mixer control 'Capture',0
Simple mixer control 'Capture',1
Simple mixer control 'Auto-Mute Mode',0
Simple mixer control 'Channel Mode',0
Simple mixer control 'Input Source',0
Simple mixer control 'Input Source',1
Simple mixer control 'Loopback Mixing',0
Simple mixer control 'Rear Mic',0
Simple mixer control 'Rear Mic Boost',0
debian@debian:~$   amixer -c 1 sset Headphone  80%
amixer: Invalid command!
debian@debian:~$  amixer -c 1 set Headphone  80%
amixer: Invalid command!
debian@debian:~$  amixer -c 1 set "Headphone"  80%
amixer: Invalid command!
debian@debian:~$  amixer -c 1 sset "Headphone"  80%
amixer: Invalid command!

More info on my amixer:

debian@debian:~$  amixer -v 
amixer version 1.2.4
debian@debian:~$  amixer -c 1 sget Headphone
Simple mixer control 'Headphone',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
showkey
  • 79
  • 23
  • 67
  • 128
  • Please post output of amixer -c 1 sget Headphone as well as the output of amixer -v – MC68020 Apr 10 '22 at 08:42
  • 1
    Since the Headphone control is of pswitch capability, you just can't adjust the volume on this one. You only can put it ON or OFF. As should be "Line' I presume. Considering your scontrols output, I would bet that volume is to be set on "Master". Confirm its capabilities with amixer -c 1 sget Master then amixer -c 1 sset Master 80% – MC68020 Apr 10 '22 at 09:11

2 Answers2

1

A/ You might prefer using the semigraphical ncurses alsamixer utility. Fire it then as informed in the upper right corner F6 to select your sound card, then simply depress cursor keys in order to set the gain for the controls you wish.

B/ Using bare metal amixer, since the control you selected appears unknown to your system, I suggest you first check what are the controls available for your card using :

$ amixer -c 1 scontrols

then, set the gain you wish on the particular control using :

$ amixer -c 1 sset controllabel 80%

in order to set the gain for this particular control.

BTW : Do not enclose the controllabel between double quotes.


Beware : Whatever controls get different capabilities. On these capabilities depend the possible settings. In order to get informations regarding some control's capabilities, fire :

$ amixer -c 1 sget some_control # adapt some_control

The control will accept changing the gain only if it gets the volume capability. If, as detailed in OP, it is of a pswitch capability, the only possibility offered is to put it on or off :

MC68020
  • 6,281
  • 2
  • 13
  • 44
0
amixer -c 1 sget Master 
amixer -c 1 sset Master 90%
showkey
  • 79
  • 23
  • 67
  • 128