1.安装最新操作系统(可到树莓派官网下载,具体参考文章:https://blog.csdn.net/m0_53222561/article/details/122605394)
2.连接树莓派(具体可参考文章:https://blog.csdn.net/m0_53222561/article/details/122611201)
3.换源(否则文件可能无法下载,或者下载速度非常慢)
sudo nano /etc/apt/sources.list //换源到清华
用#注释掉原文件内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main non-free contrib
4.安装驱动:
sudo apt-get update
sudo apt-get upgrade
git clone https://github.com/respeaker/seeed-voicecard.git
cd seeed-voicecard #下载声卡驱动
sudo ./install.sh #安装声卡驱动
reboot #重启
5.检查声卡名称是否与源代码seeed-voicecard相匹配.
pi@raspberrypi:~/seeed-voicecard $ arecord -L
null
Discard all samples (playback) or generate zero samples (capture)
playback
capture
dmixed
array
ac108
default:CARD=seeed4micvoicec
seeed-4mic-voicecard,
Default Audio Device
sysdefault:CARD=seeed4micvoicec
seeed-4mic-voicecard,
Default Audio Device
dmix:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct sample mixing device
dsnoop:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct sample snooping device
hw:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Direct hardware device without any conversions
plughw:CARD=seeed4micvoicec,DEV=0
seeed-4mic-voicecard,
Hardware device with all software conversions
如果要更改alsa设置,可以使用sudo alsactl --file=ac108_asound.state store保存。 当你需要再次使用这些设置时,将它复制到:sudo cp ~/seeed-voicecard/ac108_asound.state /var/lib/alsa/asound.state
6.录音播放测试
step 1. 录播测试 可以用arecord录制,然后用aplay播放:(不要忘记插耳机或者喇叭):
arecord -f cd -Dhw:1 | aplay -Dhw:1
也可以通过audacity软件测试。打开Audacity后,选择 AC108和2通道 作为输入,bcm2835 alsa: - (hw:0,0) 作为输出来测试
退出虚拟环境:
deactivate //退出环境
rm virtualenv 环境名 //删除环境