极简的语音交互应用,采用ctypes封装出门问问Linux SDK,目前(2018-8-21)是1.2.0版,支持“你好问问”热词唤醒,支持离线语音识别。
- arecord
- voice-engine
-
安装
voice-engine
,下载代码sudo pip install voice-engine git clone https://github.com/voice-engine/wenwen.git cd wenwen
-
下载出门问问Linux SDK,把压缩包中
lib
和.mobvoi
解压到wenwen
目录wenwen ├── .mobvoi ├── lib ├── assistant.py ├── offline.py └── player.py
-
离线模式,运行
python offline.py
离线识别“开灯”、“关灯”、“播放音乐”等语音命令 -
在线模式,在https://ai.chumenwenwen.com,注册出门问问开发者帐号,创建一个应用,获得应用的KEY,并填入`wenwen/assistan.py`
-
运行
python wenwen/assistant.py
,用”你好问问“唤醒,然后语音对话。
import time
from assistant import Assistant
from voice_engine.source import Source
# TODO: Get a key from https://ai.chumenwenwen.com
KEY = ''
def main():
src = Source(rate=16000, channels=1)
assistant = Assistant(KEY)
src.pipeline(assistant)
src.pipeline_start()
while True:
try:
time.sleep(1)
except KeyboardInterrupt:
break
src.pipeline_stop()
if __name__ == '__main__':
main()
出门问问Linux SDK来自http://ai.chumenwenwen.com/pages/document/intro。