Difference between revisions of "ALSA"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m (speaker-test)
m
Line 40: Line 40:
  
 
[[Category:Computer_Technology]]
 
[[Category:Computer_Technology]]
 +
[[Category:Linux_Sound]]
 
[[Category:Linux]]
 
[[Category:Linux]]

Revision as of 16:19, 25 March 2021

ALSA or the Advanced Linux Sound Architecture provides audio support for Linux. It is a replacement for the old OSS linux sound system. The Alsa-utils package contains both the Alsamixer and Amixer utilities. Various linux distributions once used the Open Sound System, or OSS until ALSA superseded it. ALSA provides kernel driven sound card drivers and bundles a user space driven library for application developers.

You can control the audio properties of your sound cards through:

  • Alsamixer-The graphical interface for ALSA
  • Amixer-The command based utility for ALSA

CLI Utilities

alsamixer

ncurses based utility with visual representation of various levels.

alsamixer

Enable the microphone: switch to the Capture tab with F4 and enable a channel with Space.

mixer

Command line, operation performed per command.

amixer -c [card-number] set [control] [value]

To see what controls you can manage

amixer scontrols

If you are sudo there are more controls available

sudo amixer scontrols

apulse

The apulse utility lets you use ALSA for applications that support only PulseAudio for sound.

aplay

Alsa play - play an audio file


arecord

We can test the default audio input device, or the only audio input device on a simplistic configuration

arecord -vvv -f dat /dev/null

Watch while the audio input levels are displayed as a percentage.

We can specify an audio input device

arecord -vvv --device="hw:1,0" -f dat /dev/null

You can display a list of CAPTURE Hardware Devices. To figure out what audio input device is at hw: card,device use the following command

arecord -l

The output look for "Card X" and on the same line "device X" to know the card,device combination to specify.

speaker-test

as the name implies

Example: Testing audio input / microphone input Excerpt from Troubleshooting Linux Sound by Steve Litt troubleshooting guide"

Steve says, "The speaker-test program provides a nice, easy way to provide input for your sound system. When used with no arguments, it simply supplies white noise to both speakers."

Testing an M-Audio external USB sound board it was unclear as to whether or not stereo separation was functional or if the audio was monaural (mono) since the balance slider on audio players seemed to have zero impact. Elimination of audio application software is advised to find if ALSA and your wiring are correct. Use this command:

speaker-test -c2 -t wav

As Steve advised in his article the command will alternate between left and right speaker audio dialog in a loop allowing you to listen and determine if the sound is coming from the speakers, the correct speakers and that you have functional stereo separation. You may find it useful to ensure you do not have intended left speaker audio coming out of your right speaker. If you have more than 2 channels, put the number of channels in the -c argument.

Be advised the article is very informative and we hope it remains online as well as The Steve Litt Diagnostic Tools he provides there. Thanks Steve!