RK3399Pro 音频配置
RK3399Pro 音频配置
来源 https://t.rock-chips.com/forum.php?mod=viewthread&tid=2589&extra=page%3D1
1、RK3399Pro上有三张声卡,耳机喇叭播放所用的声卡是 card 0
[root@rk3399pro:~]# cat /proc/asound/cards 0 [rockchiprk809co]: rockchip_rk809- - rockchip,rk809-codec rockchip,rk809-codec 1 [rockchiphdmi ]: rockchip_hdmi - rockchip,hdmi rockchip,hdmi 2 [Device ]: USB-Audio - USB Audio Device C-Media Electronics Inc. USB Audio Device at usb-fe380000.usb-1.3, full speed [root@rk3399pro:~]#
[root@rk3399pro:~]# amixer cget numid=1,iface=MIXER,name='Playback Path' numid=1,iface=MIXER,name='Playback Path' ; type=ENUMERATED,access=rw------,values=1,items=11 ; Item #0 'OFF' ; Item #1 'RCV' ; Item #2 'SPK' ; Item #3 'HP' ; Item #4 'HP_NO_MIC' ; Item #5 'BT' ; Item #6 'SPK_HP' ; Item #7 'RING_SPK' ; Item #8 'RING_HP' ; Item #9 'RING_HP_NO_MIC' ; Item #10 'RING_SPK_HP' : values=0 [root@rk3399pro:~]#
不同Playback Path模式的音量大小不同, Item #0 'OFF' --- 无音量 Item #2 'SPK' --- 低音量 Item #4 'HP_NO_MIC' --- 中音量 Item #7 'RING_SPK' --- 高音量 amixer cset numid=1,iface=MIXER,name='Playback Path' 0 && aplay -D hw:0,0 sn.wav amixer cset numid=1,iface=MIXER,name='Playback Path' 2 && aplay -D hw:0,0 sn.wav amixer cset numid=1,iface=MIXER,name='Playback Path' 4 && aplay -D hw:0,0 sn.wav amixer cset numid=1,iface=MIXER,name='Playback Path' 7 && aplay -D hw:0,0 sn.wav
#!/bin/sh #filename: testAlarm.sh PLAYBACK_ID=0 AUDIO_ID=0 MESSAGE_TEXT="" if [ $# -eq 0 ] then echo "Usage: ${0} AUDIO_ID " echo "Usage: ${0} AUDIO_ID MESSAGE_TEXT " echo "Usage: ${0} PLAYBACK_ID AUDIO_ID MESSAGE_TEXT " echo "e.g.: ${0} 0 7 \"Mute volume ...\" " echo "e.g.: ${0} 2 7 \"Low volume ...\" " echo "e.g.: ${0} 4 7 \"Medium volume ...\" " echo "e.g.: ${0} 7 7 \"High volume ...\" " exit elif [ $# -eq 1 ] then PLAYBACK_ID=4 AUDIO_ID=$1 MESSAGE_TEXT="test ..." elif [ $# -eq 2 ] then PLAYBACK_ID=4 AUDIO_ID=$1 MESSAGE_TEXT=$2 elif [ $# -eq 3 ] then PLAYBACK_ID=$1 AUDIO_ID=$2 MESSAGE_TEXT=$3 else echo "Usage: ${0} AUDIO_ID " echo "Usage: ${0} AUDIO_ID MESSAGE_TEXT " echo "Usage: ${0} PLAYBACK_ID AUDIO_ID MESSAGE_TEXT " exit fi echo "test audio light message ..." amixer cset numid=1,iface=MIXER,name='Playback Path' ${PLAYBACK_ID} >/dev/null 2>&1 dbus-send --system --type=signal /com/ditel/acu_agent/alarm com.ditel.acu_agent.alarm_signal string:"{\"msg_level\": 3, \"msg_type\": 2, \"msg_content\": \"${MESSAGE_TEXT}\", \"msg_valid_time\": 15, \"msg_vol_id\": ${AUDIO_ID}, \"repeat_times\": 2 }" echo "test done ..."
#### End ####
2、如果要通过耳机播放有两种方式
①、aplay -D HeadphoneNormal sn.wav (HeadphoneNormal 在/usr/share/alsa/alsa.conf有配置)
②、amixer cset numid=1,iface=MIXER,name='Playback Path' 3 && aplay -D hw:0,0 sn.wav
注意:如果是喇叭HeadphoneNormal改成SpeakerNormal,amixer cset numid=1,iface=MIXER,name='Playback Path' 2,其他类推。
3、如果要通过板载mic录音
①、arecord -D MainMicCapture -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
注意:如果是耳机mic 录音 MainMicCapture改成FreeMicCapture,amixer cset numid=2,iface=MIXER,name='Capture MIC Path' 2 。
4、通过cat /proc/asound/cards 知道默认声卡是card 0,如果不是,通过arecord、aplay、amixer配置时,需要修改对应的声卡号。
5、如果想通过hdmi out播放aplay -Dhw:1,0 sn.wav
========= End