How to change ALSA mixer parameters

From RidgeRun Developer Connection
Jump to: navigation, search



It is used to target our applications to audio and video features, in this topic we usually get a common concern about the audio control which may imply how to control the volume and outputs' properties. In this guide we explain the ALSA mixer interface to control and change those properties from command-line.

ALSA mixer GUI application

The more common interface to access the ALSA mixer properties for our sound card is the alsamixer application which implements a basic GUI interface for the sound card properties as shown in the following figure. From this interface you can control all the available properties for your sound card, but this is not a practical method to automatically change those setting since it need of the user interaction.

How to control ALSA mixer properties from command-line

  • Print possible ALSA mixer controls
/ # amixer -c 0 controls
numid=20,iface=MIXER,name='AVADC Clock Priority'
numid=19,iface=MIXER,name='Analog Capture Volume'
numid=29,iface=MIXER,name='Analog Left AUXL Capture Switch'
numid=30,iface=MIXER,name='Analog Left Carkit Mic Capture Switch'
numid=28,iface=MIXER,name='Analog Left Headset Mic Capture Switch'
numid=27,iface=MIXER,name='Analog Left Main Mic Capture Switch'
numid=26,iface=MIXER,name='Analog Right AUXR Capture Switch'
numid=25,iface=MIXER,name='Analog Right Sub Mic Capture Switch'
numid=15,iface=MIXER,name='Carkit Playback Volume'
numid=43,iface=MIXER,name='CarkitL Mixer AudioL1'
numid=44,iface=MIXER,name='CarkitL Mixer AudioL2'
numid=42,iface=MIXER,name='CarkitL Mixer Voice'
numid=40,iface=MIXER,name='CarkitR Mixer AudioR1'
numid=41,iface=MIXER,name='CarkitR Mixer AudioR2'
numid=39,iface=MIXER,name='CarkitR Mixer Voice'
numid=1,iface=MIXER,name='Codec Operation Mode'
numid=12,iface=MIXER,name='DAC Voice Analog Downlink Switch'
numid=11,iface=MIXER,name='DAC Voice Analog Downlink Volume'
numid=10,iface=MIXER,name='DAC Voice Digital Downlink Volume'
numid=8,iface=MIXER,name='DAC1 Analog Playback Switch'
numid=6,iface=MIXER,name='DAC1 Analog Playback Volume'
numid=4,iface=MIXER,name='DAC1 Digital Coarse Playback Volume'
numid=2,iface=MIXER,name='DAC1 Digital Fine Playback Volume'
numid=9,iface=MIXER,name='DAC2 Analog Playback Switch'
numid=7,iface=MIXER,name='DAC2 Analog Playback Volume'
numid=5,iface=MIXER,name='DAC2 Digital Coarse Playback Volume'
numid=3,iface=MIXER,name='DAC2 Digital Fine Playback Volume'
numid=24,iface=MIXER,name='Digimic LR Swap'
numid=60,iface=MIXER,name='Earpiece Mixer AudioL1'
numid=61,iface=MIXER,name='Earpiece Mixer AudioL2'
numid=62,iface=MIXER,name='Earpiece Mixer AudioR1'
numid=59,iface=MIXER,name='Earpiece Mixer Voice'
numid=16,iface=MIXER,name='Earpiece Playback Volume'
numid=21,iface=MIXER,name='HS ramp delay'
numid=38,iface=MIXER,name='HandsfreeL Mux'
numid=37,iface=MIXER,name='HandsfreeL Switch'
numid=36,iface=MIXER,name='HandsfreeR Mux'
numid=35,iface=MIXER,name='HandsfreeR Switch'
numid=14,iface=MIXER,name='Headset Playback Volume'
numid=49,iface=MIXER,name='HeadsetL Mixer AudioL1'
numid=50,iface=MIXER,name='HeadsetL Mixer AudioL2'
numid=48,iface=MIXER,name='HeadsetL Mixer Voice'
numid=46,iface=MIXER,name='HeadsetR Mixer AudioR1'
numid=47,iface=MIXER,name='HeadsetR Mixer AudioR2'
numid=45,iface=MIXER,name='HeadsetR Mixer Voice'
numid=65,iface=MIXER,name='Left Digital Loopback Volume'
numid=69,iface=MIXER,name='Left1 Analog Loopback Switch'
numid=67,iface=MIXER,name='Left2 Analog Loopback Switch'
numid=13,iface=MIXER,name='PreDriv Playback Volume'
numid=56,iface=MIXER,name='PredriveL Mixer AudioL1'
numid=57,iface=MIXER,name='PredriveL Mixer AudioL2'
numid=58,iface=MIXER,name='PredriveL Mixer AudioR2'
numid=55,iface=MIXER,name='PredriveL Mixer Voice'
numid=54,iface=MIXER,name='PredriveR Mixer AudioL2'
numid=52,iface=MIXER,name='PredriveR Mixer AudioR1'
numid=53,iface=MIXER,name='PredriveR Mixer AudioR2'
numid=51,iface=MIXER,name='PredriveR Mixer Voice'
numid=64,iface=MIXER,name='Right Digital Loopback Volume'
numid=70,iface=MIXER,name='Right1 Analog Loopback Switch'
numid=68,iface=MIXER,name='Right2 Analog Loopback Switch'
numid=32,iface=MIXER,name='TX1 Capture Route'
numid=17,iface=MIXER,name='TX1 Digital Capture Volume'
numid=31,iface=MIXER,name='TX2 Capture Route'
numid=18,iface=MIXER,name='TX2 Digital Capture Volume'
numid=23,iface=MIXER,name='Vibra H-bridge direction'
numid=22,iface=MIXER,name='Vibra H-bridge mode'
numid=34,iface=MIXER,name='Vibra Mux'
numid=33,iface=MIXER,name='Vibra Route'
numid=66,iface=MIXER,name='Voice Analog Loopback Switch'
numid=63,iface=MIXER,name='Voice Digital Loopback Volume'

  • Get an ALSA mixer control value
/ # amixer -c 0 cget numid=20 
numid=20,iface=MIXER,name='AVADC Clock Priority'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'Voice high priority'
  ; Item #1 'HiFi high priority'
  : values=1
  • Set a new value for an ALSA mixer control
/ # amixer -c 0 cset numid=20 0
numid=20,iface=MIXER,name='AVADC Clock Priority'
  ; type=ENUMERATED,access=rw------,values=1,items=2
  ; Item #0 'Voice high priority'
  ; Item #1 'HiFi high priority'
  : values=0