两个测试镜像:
1、烧录树莓派3B+最新镜像,2018.4.18,
2、2018-08-06-raspbian-4GB-for-respeaker.img
https://v2.fangcloud.com/share/7395fd138a1cab496fd4792fe5?folder_id=188000207913
首次使用,需要HDMI链接显示器;
开机,打开ssh VNC,链接网线,打开并设置WiFi接入,
设置完成后重启,即可测试链接WiFi,ssh(端口:22) VNC(端口5900);
硬件驱动只能直接安装到树莓派:
ReSpeaker 4-Mics Pi HAT
sudo apt-get update
sudo apt-get upgrade
git clone https://github.com/respeaker/seeed-voicecard.git
cd seeed-voicecard #下载声卡驱动
sudo ./install.sh #安装声卡驱动
reboot #重启
# Raspbian for ReSpeaker
The Raspbian images for ReSpeaker contain pre-installed software packages:
+ seeed-voicecard - sound cards' driver
+ snowboy - keyword search
+ avs - python alexa voice service sdk
+ python-webrtc-audio-processing - noise suppression
+ speexdsp-python - acoustic echo cancellation
+ voice-engine
+ examples for respeaker series mic arrays (/home/pi/respeaker)
It will be super easy to build a voice assistant with the images.
After you login the pi, you can try the examples at `/home/pi/respeaker`
```
cd /home/pi/respeaker
git pull origin master # update to the latest examples
python ns_kws.py # it will detect the keyword "snowboy"
```
### Alexa Voice Service
1. authorization
run `alexa-auth` and open http://raspberrypi.local:3000 to login your amazon alexa voice service or baidu dueros
2. run `alexa-tap`
3. run `python /home/pi/respeaker/ns_kws_alexa.py` to start hands-free voice interaction (keyword "alexa")
测试
arecord -L
2. 录音播放测试:(不要忘记插耳机或者喇叭):
通过audacity软件测试。打开Audacity后,选择 AC108和2通道 作为输入,bcm2835 alsa: - (hw:0,0) 作为输出来测试:
sudo apt install audacity
audacity
alsamixer 是用于配置声音设置和调整音量,高级Linux声音体系结构(ALSA)的图形混音器程序。
alsamixer
树莓派 + Docker - 轻松实现人脸识别应用
https://blog.csdn.net/jacka654321/article/details/82291140
安装 docker:
sudo curl -sSL https://get.docker.com | sh
sudo usermod pi -aG docker
echo Adding " cgroup_enable=cpuset cgroup_enable=memory" to /boot/cmdline.txt
sudo cp /boot/cmdline.txt /boot/cmdline_backup.txt
# if you encounter problems, try changing cgroup_memory=1 to cgroup_enable=memory.
如果出错可以尝试次步,本例正常,无需执行这一步;
orig="$(head -n1 /boot/cmdline.txt) cgroup_enable=cpuset cgroup_memory=1"
echo $orig | sudo tee /boot/cmdline.txt
完成后重启;
sudo reboot
[frpc穿透] 【Frp的Docker使用教程】frp for docker教程
http://koolshare.cn/thread-115649-1-1.html
下载导入docker-frp镜像:
wget --no-check-certificate https://code.aliyun.com/clangcn/frp-docker/raw/master/frpc-docker/frpc-docker.tar
sudo docker load < frpc-docker.tar
下载配置文件:
wget --no-check-certificate https://code.aliyun.com/clangcn/frp-docker/raw/master/frpc-docker/frpc.ini -O ~/frpc.ini
本例已经搭建好服务器端frps,只需配置frpc端即可;
参考上面frp for docker教程链接或下面链接:
树莓派 frp内网穿透
https://blog.csdn.net/jacka654321/article/details/80879018
修改frpc配置:
nano /home/pi/frpc.ini
启动容器:
sudo docker run -h="frpc-docker" --name frpc-docker -d \
-v /home/pi/frpc.ini:/usr/local/frpc/frpc.ini \
"frpc-docker:latest"
--restart=always
sudo docker run -d -h="frpc-docker" --name frpc-docker --privileged -v ~/frpc.ini:/usr/local/frpc/frpc.ini --restart=always "frpc-docker:latest"
pull opencv2.4镜像:
docker pull al42and/debian-opencv2:raspberrypi
因为Xserver默认情况下不允许别的用户的图形程序的图形显示在当前屏幕上. 如果需要别的用户的图形显示在当前屏幕上, 则应以当前登陆的用户, 也就是切换身份前的用户执行如下命令
sudo xhost +
启动容器:
sudo docker run -it --privileged --device /dev/vchiq --device /dev/video0 --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" al42and/debian-opencv2:raspberrypi
电脑端通过VNC复制文件到树莓派桌面,再通过docker cp 复制到容器:
sudo docker cp /home/pi/Desktop/smart_car-master.zip ca3cbce8c865:/home
解压测试;
apt-cache search unzip
因为无法下载安装服务,无法更新,无法编写源,源码安装vim失败;所以只好直接docker cp,从主机 复制 sources.list 到容器对应目录;
首先进入容器,备份sources.list:
cd /etc/apt/
sudo mv /etc/apt/sources.list sources.list.bak
树莓派更新源:先注释原来的,再复制粘贴下面代码,用阿里云的源,清华源备用;
deb http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ wheezy main non-free contrib
#deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ wheezy main non-free contrib
#deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ wheezy main non-free contrib
主机执行docker cp:
sudo docker cp /etc/apt/sources.list ca3cbce8c865:/etc/apt/
sudo apt-get upgrade和sudo apt-get update 更新失败,可以重复几次,或exit退出,再进去更新 ;
重新进入容器:
sudo docker start ca3cbce8c865
sudo docker exec -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --privileged ca3cbce8c865 /bin/bash
终于可以更新了,
sudo apt-get upgrade
sudo apt-get update
接着就可以正常安装服务:
安装文本编辑工具nano:
apt-cache search nano
sudo apt-get install nano
安装解压工具unzip:
apt-cache search unzip
sudo apt-get install unzip
cd 进home文件夹,解压smart_car-master.zip ;
cd /home/
unzip smart_car-master.zip
配置语音环境:
git clone https://github.com/respeaker/4mics_hat.git
cd 4mics_hat/
需要安装spidev 、gpiozero 和 rpi.gpio模块:
apt-cache search spidev
apt-cache search gpiozero
apt-cache search rpi.gpio
apt-cache search libatlas-base-dev
apt-cache search python-pyaudio
sudo apt-get install python-spidev
sudo apt-get install python-gpiozero
sudo apt-get install python-rpi.gpio
sudo apt-get install libatlas-base-dev
sudo apt-get install python-pyaudio
pip install ./snowboy*.whl
pip install ./webrtc*.whl
cd ..返回上级目录,下载voice-engine:
cd ..
git clone https://github.com/voice-engine/voice-engine
安装
cd voice-engine/
python setup.py install
sudo apt-cache search OpenSSL
sudo apt-get install python-openssl
安装必要的库:
sudo apt install python-pyaudio python-numpy python-virtualenv
sudo apt-get install swig python-dev libatlas-base-dev build-essential make
下载并安装snoboy:
git clone --depth 1 https://github.com/Kitt-AI/snowboy.git
cd snowboy
python setup.py build
python setup.py bdist_wheel
pip install dist/snowboy*.whl
测试文件:
python pixels.py