brew install portaudio
brew install mpg123
brew install pkg-config
brew install swig
sudo apt-get install portaudio19-dev
sudo apt-get install libmpg123-dev
# 由于树莓派自带的swig版本太低,需要手动编译
sudo apt-get install libpcre3-dev
wget http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz
tar xzf swig-3.0.12.tar.gz
cd swig-3.0.12
./configure && make && sudo make install
go get -d github.com/icexin/dueros
cd $GOPATH/src/github.com/icexin/dueros
go build
编辑/etc/hosts
- 如果运行在树莓派上就配置树莓派的ip,例如树莓派的地址为192.168.1.2,则配置
192.168.1.2 pi.local
- 如果运行在本机,则配置
127.0.0.1 pi.local
第一次运行需要指定client_id
和client_secret
参数
dueros --client_id=$id --client_secret=$secret
在浏览器输入http://pi.local:8080/login
,按照提示进行授权,完成之后会在当前目录下生成token.json
目录下生成token.json
之后再运行就不需要进行授权了
通过运行的时候指定 --access_token
,就不需要之前的步骤直接运行,当然得需要别人给你access_token
--wakeup
参数指定唤醒方式,有keyboard
和keyword
两种方式,分别对应敲击回车和语音关键字来唤醒机器人 :)
默认是语音唤醒
当屏幕上出现 >>> 等待唤醒
的时候就可以使用了,说小度小度
后,听到叮
的一声后,说一句唱首歌儿
- 进入 https://snowboy.kitt.ai/
- 训练好唤醒词之后,替换
resource/wakeup.pmdl
- 重新启动程序
部分程序代码实现功能并没有严谨推敲,另外部分地方并不是协程安全,欢迎批评交流。
MIT License
Copyright (c) 2017 fanbingxin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.