【BIGTREETECH PI开发板】+08.音频测试(zmj)
BIGTREETECH Pi开发板拥有一个3.5mm音频接口,既可以播放音乐也可以用来录音。理论上讲可以一边听歌一边玩开发板(●'◡'●)
1. 程序安装
BIGTREETECH Pi开发板的系统支持常见的各种音频播放器软件,大家可以依据自己喜好自行选择,我这边安装了一堆……
//------播放器及依赖安装(可选)
sudo apt install zoom-player wordplay wdisplays \
vdr-plugin-mplayer smplayer sidplay qtav-players \
playmidi playerctl multimedia-players node-react-audio-player \
mplayer* media-player-info madplay gbsplay alsaplayer*
2. 音频测试
各测试项的详细内容参考Log日志记录。
2.1 声卡检测
声卡检测通过“aplay -l”或者“aplay -L”可以查看。通过Log信息可以看到划分了三个声卡:card-0/card-1/card-2。
功能划分:card-0用于处理多媒体、系统和伴流;card-1是HDMI接口的音频流;card-2是CPU的音频编解码。此处主要测试card-0。
BIGTREETECH Pi开发板的系统中划分声卡的具体原理还没有深入研究,应该和设备树、驱动相关,汗……
2.2 音频播放
音频播放我测试了“gst-play-1.0(播放mp3/wav文件)”和“aplay(播放wav文件)”。
2.3 录音功能
录音功能包括录音和播放录音的测试。其中录音使用的“arecord”,播放录音使用的“gst-play-1.0”.
//------声卡检测
biqu@BTT-CB1:~/zmj_ws/music$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndahub [sndahub], device 0: Media Stream sunxi-ahub-aif1-0 [Media Stream sunxi-ahub-aif1-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: sndahub [sndahub], device 1: System Stream sunxi-ahub-aif2-1 [System Stream sunxi-ahub-aif2-1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: sndahub [sndahub], device 2: Accompany Stream sunxi-ahub-aif2-2 [Accompany Stream sunxi-ahub-aif2-2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: allwinnerhdmi [allwinner-hdmi], device 0: hdmi i2s-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Codec [H616 Audio Codec], device 0: CDC PCM Codec-0 [CDC PCM Codec-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
//------音频播放(mp3和wav)
biqu@BTT-CB1:~/zmj_ws/music$ find / -name *.mp3
./Born a Stranger.mp3
./The promise.mp3
biqu@BTT-CB1:~/zmj_ws/music$ gst-play-1.0 ./
Press 'k' to see a list of keyboard shortcuts.
Now playing /usr/share/myir/Music/Born a Stranger.mp3
Redistribute latency...
0:01:41.7 / 0:01:41.7
Now playing /usr/share/myir/Music/The promise.mp3
Redistribute latency...
0:03:15.8 / 0:03:15.8
Reached end of play list.
biqu@BTT-CB1:~/zmj_ws/music$ ll /usr/share/sounds/alsa/
total 5076
-rw-rw-r-- 1 root root 1982048 Mar 3 09:10 audio.wav
-rw-r--r-- 1 root root 137134 Dec 7 2020 Front_Center.wav
-rw-r--r-- 1 root root 142128 Dec 7 2020 Front_Left.wav
-rw-r--r-- 1 root root 146990 Dec 7 2020 Front_Right.wav
-rw-rw-r-- 1 root root 1972332 Mar 3 09:10 mute.wav
-rw-r--r-- 1 root root 135202 Dec 7 2020 Noise.wav
-rw-r--r-- 1 root root 130096 Dec 7 2020 Rear_Center.wav
-rw-r--r-- 1 root root 126064 Dec 7 2020 Rear_Left.wav
-rw-r--r-- 1 root root 146480 Dec 7 2020 Rear_Right.wav
-rw-r--r-- 1 root root 134868 Dec 7 2020 Side_Left.wav
-rw-r--r-- 1 root root 129966 Dec 7 2020 Side_Right.wav
biqu@BTT-CB1:~/zmj_ws/music$ aplay /usr/share/sounds/alsa/audio.wav
Playing WAVE '/usr/share/sounds/alsa/audio.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
biqu@BTT-CB1:~/zmj_ws/music$ aplay /usr/share/sounds/alsa/Noise.wav
Playing WAVE '/usr/share/sounds/alsa/Noise.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
//------录音功能(包括录音和播放录音)
biqu@BTT-CB1:~/zmj_ws/music$ arecord -f cd audio_test.wav
Recording WAVE 'audio_test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stere
o ^
CAborted by signal Interrupt..
biqu@BTT-CB1:~/zmj_ws/music$ gst-play-1.0 audio_test.wav
Press 'k' to see a list of keyboard shortcuts.
Now playing audio_test.wav
Redistribute latency...
0:00:18.6 / 0:00:18.6
//------声卡设置(包括音量调节)
biqu@BTT-CB1:~/zmj_ws/music$ alsamixer
2.4 声卡设置
使用“alsamixer”可以对每块声卡进行配置,它是一个图形界面的配置工具,用于配置音频的各个参数,可以通过该命令设置耳机输出的音量大小。
//------alsamixer综合界面:
//------alsamixer查看帮助F1:
//------end