Get the App
SLTechnology News&Howtos  ›  Servers  › 

Arm linux uses alsa to drive and use usb audio devices

Shulou Source: shulou.com Published: 2022-06-02 02:21:59 10月01日 Update

one。 Background:

The kernel version of arm linux is 3.13.0

two。 Preparatory work

Add alsa drivers to the kernel, that is, add the following options when compiling the kernel:

Then you can recompile the kernel.

three。 Cross-compile alsa-lib and alsa-utils (alsa-utils is a series of audio device control tools, and alsa-lib is the library that alsa-utils depends on, so compile alsa-lib first)

3.1 Cross-compile alsa-lib

3.2 Cross-compile alsa-utils

four。 Copy all the three compiled libraries and tools to the arm development board (the author usually directly compresses the compiled libraries and then copies them to the development board to decompress them, so as to avoid the situation that soft links cannot be copied directly)

five。 Use the tools in alsa-utils for all kinds of operations

5.1 recording:

Arecord-D "plughw:0,0" demo.wmv

5.2 play:

Aplay-D "plughw:0,0" demo.wmv

5.3 obtain control information:

Amixer controls

The output information is as follows:

Numid=3,iface=MIXER,name='Master Mode Switch'numid=29,iface=MIXER,name='Master Mux'numid=4,iface=MIXER,name='Master Quality Switch'numid=2,iface=MIXER,name='Master Switch'numid=1,iface=MIXER,name='Master Volume'numid=7,iface=MIXER,name='PCM Mode Switch'numid=6,iface=MIXER,name='PCM Switch'numid=5,iface=MIXER,name='PCM Volume'numid=9,iface=MIXER,name='Mic Switch'numid=8,iface=MIXER,name='Mic Volume'

5.4 get the volume when recording

The message "numid=8,iface=MIXER,name='Mic Volume'" can be obtained from 5.3. you can know from Mic Volume that it is the volume of Mic.

Amixer cget numid=8,iface=MIXER,name='Mic Volume'

5.4 set the volume for recording

Amixer cset numid=8,iface=MIXER,name='Mic Volume' 255

Six: points for attention:

If you copy the tools in the compiled alsa-utils to a storage device in fat32 format, note that fat32 does not support soft links. In this case, you need to directly copy an aplay and change the name to arecord:

Cp aplay arecord

Summary

The above is the editor to introduce to you the use of arm linux alsa driver and the use of usb audio equipment, I hope to help you!

Tags: Compilation kernel tools devices information volume crossover audio drivers size time links development control and then that is items names storage devices situations Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple OPPO Reno Shulou Tech Info Redmi macOS