Linux ALSA Audio Tools

Reference:
ALSA audio tools amixer, aplay, arecord
Linux Alsa
ALSA configuration file

Audio recording - arecord
audio playback - aplay
audio configuration - amixer

The difference between alsamixer and amixer
alsamixer is one of the ALSA tools of the Linux audio framework, which is used to configure various audio parameters;
alsamixer is based on a text-based graphical interface, which can be displayed in the terminal. Volume settings, switch operations, etc. can be realized through the up and down keys, left and right keys, etc. of the keyboard.

Amixer is the text mode of alsamixer, that is, the command line mode. It uses the command line to configure various options of the sound card, such as selecting whether the audio input channel is Mic input or Line input.

1. Adjust volume and other parameters

sudo alsamixer

insert image description here

2. Play an audio

sudo aplay /opt/factory_tester/HDMI/test_vioce.wav

3. aplay -l lists sound cards and digital audio devices

sudo aplay -l

insert image description here

4. ALSA configuration state saving, restoration and automatic loading

In actual use, it is often necessary to dynamically modify the configuration information of the sound card, such as updating the Mixer information in asoundrc. If you do not save the current configuration state of the sound card, it will restore to the original state when you start the system next time. To this end, it is necessary for us to save the configuration state of the sound card. The sound card configuration state saving tool is: alsactl, and the specific saving command is:

Save the sound card information status

alsactl store -f /var/lib/alsa/asound.state 

In this way, the asound.state file is generated in the /var/lib/alsa/ directory, which saves the state configuration information of the sound card, including commonly used mixer configuration information.
The corresponding sound card state recovery command is:

Sound Card Status Restoration Command

alsactl restore -f /var/lib/alsa/asound.state

Guess you like

Origin blog.csdn.net/weixin_44618297/article/details/130812067