snowboy使用流程
一.环境
1.linux虚拟机Ubuntu20.04
2.python3.8
二.准备
安装sox
sudo apt-get install sox
安装完可以试一下
sox -d -d
你会听到自己的录音
三.安装依赖
1.安装swig`
sudo apt-get install swig
2.安装ATLAS
sudo apt-get install libatlas-base-dev
3.安装PyAudio
pip install pyaudio
四.编译源码
1.获取源码
git clone https://github.com/Kitt-AI/snowboy.git
2.swig 编译环境
cd snowboy/swig/Python3 && make
因为我是在python3的环境,所以会选择swig下的python3进行编译
五.测试demo
进入官方示例的目录,在终端输入
python3 demo.py resources/models/snowboy.umdl
snowboy.umdl是模型文件,到时有自己的模型文件,就可以用自己喜欢的名字唤醒!
自定义唤醒词网站:https://snowboy.hahack.com/
六.遇到的问题
1.在测试sox无声
解决方法:
在虚拟机的设置里,设置声卡
2.再装一些依赖的依赖时,都是出现装不成功的情况。
问题可能是:之前换国内软件源与Ubuntu版本对不上导致的
解决方法:查看Ubuntu版本,更换符合版本的国内软件源。
查看Ubuntu版本
cat /etc/issue
更换源
1.打开sources.list
sudo gedit /etc/apt/sources.list
以前我就已经备份了官方的源,所以备份源就省略了
2.把以下内容覆盖sources.list里的内容
Ubuntu 20.04配置
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
3.更新源
sudo apt-get update
3.装PyAudio库时,出现问题
解决方法:安装依赖库
sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
4.swig编译出现问题
问题是:系统说找不到Python.h
解决方法:sudo apt-get install python3-dev