Use alsa library to play recorded audio

rk3399 uac audio recording:

 

This post was last edited by jefferyzhang at 2020-12-11 10:49

1. There are three sound cards on RK3399Prod. The sound card used for headphone speaker playback is card 0
cat /proc/
asound /cards 0 [rockchiprk809co]: rockchip_rk809--rockchip,rk809 -codec
                      rockchip,rk809-codec
1 [rockchiphdmi]: rockchip_hdmi-rockchip,hdmi
                      rockchip,hdmi
2 [RKmsm261s4030h0]: RK_msm261s4030h-RK_msm261s4030h0
                      RK_msm261s4030h0 RK_msm261s4030h0

2. If you want to play through headphones, there are two ways
(Norphoneplay -Dmalvphone, Headphone. It is configured in /usr/share/alsa/alsa.conf)
②, amixer cset numid=1,iface=MIXER,name='Playback Path' 3 && aplay -Dhw:0,0 sn.wav
Note: If it is a speaker HeadphoneNormal Change to SpeakerNormal, amixer cset numid=1, iface=MIXER, name='Playback Path' 2, and so on.
3. If you want to record through the onboard
mic①, arecord -DMainMicCapture -r 44100 -f S16_LE -c 2 -d 10 /etc/main.wav
②, amixer cset numid=2, iface=MIXER,name='Capture MIC Path '1 && arecord -Dhw:0,0 -r44100 -f S16_LE -c 2 -d 10 /etc/main.wav
Note: If it is earphone mic recording, MainMicCapture is changed to FreeMicCapture, amixer cset numid=2,iface=MIXER,name ='Capture MIC Path' 2.
4. Through cat /proc/asound/cards, you know that the default sound card is card 0. If not, you need to modify the corresponding sound card number when configuring through arecord, aplay, and amixer.
5. If you want to play aplay through hdmi out -Dhw:1,0 sn.wav

Guess you like

Origin blog.csdn.net/sunxiaopengsun/article/details/114009807