part I
[1.安装 sox ,ffmpeg 和 PyAudio:]
sudo apt-get install portaudio19-dev python-pyaudio python3-pyaudio sox pulseaudio libsox-fmt-all ffmpeg
pip3 install pyaudio
[2.安装 启动依赖]
然后cd 文件目录安装第一部分依赖,用于交互
pip3 install -r requirements.txt
*具体requirements.txt文件内容*
pyyaml>=4.2b1
requests==2.21.0
baidu-aip==2.0.0.1
pydub==0.23.1
python-dateutil==2.7.5
watchdog==0.9.0
pytz==2018.9
fire==0.1.3
tornado==5.1.1
markdown==3.0.1
semver==2.8.1
websocket==0.2.1
websocket-client==0.56.0
pyjwt==1.7.1
pypinyin
jieba
注意websocket一定安装到位~~~~
[3.编译snowboy]
[3.1安装 swig]
确保系统已经有swig
wget http://hahack-1253537070.file.myqcloud.com/misc/swig-3.0.10.tar.gz
tar xvf swig-3.0.10.tar.gz
cd swig-3.0.10
sudo apt-get -y update
sudo apt-get install -y libpcre3 libpcre3-dev
./configure --prefix=/usr --without-clisp --without-maximum-compile-warnings
make
sudo make install
sudo install -v -m755 -d /usr/share/doc/swig-3.0.10
sudo cp -v -R Doc/* /usr/share/doc/swig-3.0.10
sudo apt-get install -y libatlas-base-dev
如果提示找不到 python3-config 命令,你还需要安装 python3-dev:
sudo apt-get install python3-dev # 注意 Ubuntu 18.04 可能叫 python3-all-dev
[3.2编译snowboy]
wget http://hahack-1253537070.file.myqcloud.com/misc/snowboy.tar.bz2 # 使用我fork出来的版本以确保接口兼容
tar -xvjf snowboy.tar.bz2
cd snowboy/swig/Python3
make
cp _snowboydetect.so <文件~~~~根目录/snowboy/>
如果遇到bug:
snowboy bug
/swig-3.0.10/snowboy/swig/Python3 $^C
[4.树莓派&香橙派设备运行之前还需要注意]
[4.1是否安装wiringPi]
查看wiring版本信息
gpio -v
返回如下:ok
gpio version: 2.50
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty
Raspberry Pi Details:
Type: Pi 2, Revision: 01, Memory: 1024MB, Maker: Embest
* Device tree is enabled.
*--> Raspberry Pi 2 Model B Rev 1.1
* This Raspberry Pi supports user-level GPIO access.
查看io信息
gpio readall
返回如下map
+-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 2 | 8 | SDA.1 | ALT0 | 1 | 3 || 4 | | | 5v | | |
| 3 | 9 | SCL.1 | ALT0 | 1 | 5 || 6 | | | 0v | | |
| 4 | 7 | GPIO. 7 | IN | 0 | 7 || 8 | 1 | ALT0 | TxD | 15 | 14 |
| | | 0v | | | 9 || 10 | 1 | ALT0 | RxD | 16 | 15 |
| 17 | 0 | GPIO. 0 | IN | 0 | 11 || 12 | 0 | IN | GPIO. 1 | 1 | 18 |
| 27 | 2 | GPIO. 2 | IN | 0 | 13 || 14 | | | 0v | | |
| 22 | 3 | GPIO. 3 | IN | 0 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 |
| | | 3.3v | | | 17 || 18 | 0 | IN | GPIO. 5 | 5 | 24 |
| 10 | 12 | MOSI | ALT0 | 0 | 19 || 20 | | | 0v | | |
| 9 | 13 | MISO | ALT0 | 0 | 21 || 22 | 0 | IN | GPIO. 6 | 6 | 25 |
| 11 | 14 | SCLK | ALT0 | 0 | 23 || 24 | 1 | OUT | CE0 | 10 | 8 |
| | | 0v | | | 25 || 26 | 1 | OUT | CE1 | 11 | 7 |
| 0 | 30 | SDA.0 | IN | 1 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 |
| 5 | 21 | GPIO.21 | IN | 1 | 29 || 30 | | | 0v | | |
| 6 | 22 | GPIO.22 | IN | 1 | 31 || 32 | 0 | IN | GPIO.26 | 26 | 12 |
| 13 | 23 | GPIO.23 | IN | 0 | 33 || 34 | | | 0v | | |
| 19 | 24 | GPIO.24 | IN | 0 | 35 || 36 | 0 | IN | GPIO.27 | 27 | 16 |
| 26 | 25 | GPIO.25 | IN | 0 | 37 || 38 | 0 | IN | GPIO.28 | 28 | 20 |
| | | 0v | | | 39 || 40 | 0 | IN | GPIO.29 | 29 | 21 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+
否则执行安装
要安装git要安装git要安装git要安装git*
sudo apt-get install git-core
如果bug更新刷一刷
sudo apt-get update
安装来了
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
若需要更新wiringPi库,输入以下命令:
cd wiringPi
git pull origin
最后,再来一个检查
gpio -v
树莓派一般自备wiringPi,香橙派?就看看了
[5.关于ReSpeaker_Mic_Array_v2.0]
[5.1关于驱动]
Linux :无需安装驱动
对于 Linux 系统 :ReSpeaker Mic Array v2.0 支持 USB DFU。可通过python script dfu.py来通过 USB 更新固件。
sudo apt-get update
sudo pip install pyusb click
git clone https://github.com/respeaker/usb_4_mic_array.git
cd usb_4_mic_array
sudo python dfu.py --download 1_channel_firmware.bin
# 上面的dfu参数可以在respeaker/usb_4_mic_array.git上查看可以选择下载固件
[5.2led]
git clone https://github.com/respeaker/pixel_ring.git
cd pixel_ring
sudo python setup.py install
sudo python examples/usb_mic_array.py
例子
import time from pixel_ring
import pixel_ring
if __name__ == '__main__':
pixel_ring.change_pattern('echo')
while True:
try:
pixel_ring.wakeup()
time.sleep(3)
pixel_ring.think()
time.sleep(3)
pixel_ring.speak()
time.sleep(6)
pixel_ring.off()
time.sleep(3)
except KeyboardInterrupt:
break
pixel_ring.off()
time.sleep(1)
暂时这样,
对于Part II部分的requirement.txt根据实现的功能进行配置安装
AnyQ暂时~~~~
图像api暂时~~~~
其他功能暂时~~~~
homekit~
配置笔录。~~~~