Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Arm linux uses alsa to drive and use usb audio devices

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report