Linux: alsa sound commands, howto
Pulse Audio (linux command pavucontrol) is definitely one of the best ways
to handle sound settings under linux. Once in a while it might however be good
to use the alsa sound commands directly since they offer some extra settings
dependent on the sound cards capabilities.
Listing alsa devices and sound cards
One would expect that alsamixer is able to provide control of all sound card features and that is the case but you need the card number or device and alsamixer is not capable to list the available choices. You need to use aplay or arecord to get that information:
List card numbers:
aplay -l
or
arecord -l
List devices (things within a card):
play -L
or
arecord -L
Examples:
guido@ecopad ~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
guido@ecopad ~ $ arecord -L
default:CARD=Intel
HDA Intel, CONEXANT Analog
Default Audio Device
front:CARD=Intel,DEV=0
HDA Intel, CONEXANT Analog
Front speakers
surround40:CARD=Intel,DEV=0
HDA Intel, CONEXANT Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
HDA Intel, CONEXANT Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
HDA Intel, CONEXANT Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
HDA Intel, CONEXANT Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
HDA Intel, CONEXANT Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=Device
USB Audio Device, USB Audio
Default Audio Device
front:CARD=Device,DEV=0
USB Audio Device, USB Audio
Front speakers
surround40:CARD=Device,DEV=0
USB Audio Device, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=Device,DEV=0
USB Audio Device, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device,DEV=0
USB Audio Device, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device,DEV=0
USB Audio Device, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device,DEV=0
USB Audio Device, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device,DEV=0
USB Audio Device, USB Audio
IEC958 (S/PDIF) Digital Audio Output
Using alsamixer
In most cases it's the easiest to start alsamixer for a specific card. To know which card is which you use the above commands.
Start alsamixer for card 1:
alsamixer -V all -c 1
You quit alsamixer with Esc.
The first card (usally the on-board audio card) is card 0.
To go from control to you use the arrow left and right keys.
You change the volume with the arrow up/down keys and you can mute or un-mute
a controller with the m-key.
F1 displays a help and you get out of help by pressing Enter.
© Guido Socher,