项目作者: voice-engine

项目描述 :
building blocks to create voice interface applications
高级语言: Python
项目地址: git://github.com/voice-engine/voice-engine.git
创建时间: 2017-08-23T06:36:28Z
项目社区:https://github.com/voice-engine/voice-engine

开源协议:GNU General Public License v3.0

下载


Voice Engine

Build Status

The library is used to create voice interface applications.
It includes building blocks such as KWS (keyword spotting), DOA (Direction Of Arrival). There are also elements to measure RMS (dBFS or dB(A)).

Requirements

  • pyaudio
  • numpy
  • snowboy

Installation

Install pyaudio, numpy and snowboy, use virtualenv a virtual python environment.

  1. sudo apt install python-pyaudio python-numpy python-virtualenv
  2. sudo apt-get install swig python-dev libatlas-base-dev build-essential make
  3. git clone --depth 1 https://github.com/Kitt-AI/snowboy.git
  4. cd snowboy
  5. virtualenv --system-site-packages env
  6. source env/bin/activate
  7. python setup.py build
  8. python setup.py bdist_wheel
  9. pip install dist/snowboy*.whl
  10. cd ..
  11. git clone https://github.com/voice-engine/voice-engine.git
  12. cd voice-engine
  13. python setup.py bdist_wheel
  14. pip install dist/*.whl

Get started

To record audio and search keyword “snowboy”, see also kws_snowboy.py

  1. import time
  2. from voice_engine.kws import KWS
  3. from voice_engine.source import Source
  4. src = Source()
  5. kws = KWS()
  6. src.link(kws)
  7. def on_detected(keyword):
  8. print('found {}'.format(keyword))
  9. kws.on_detected = on_detected
  10. kws.start()
  11. src.start()
  12. while True:
  13. try:
  14. time.sleep(1)
  15. except KeyboardInterrupt:
  16. break
  17. kws.stop()
  18. src.stop()

Building blocks

The library uses gstreamer-like elements which can be linked together as an audio pipeline.
One element can connect to more than one other elements.

The topology can be:

  1. Source --> ChannelPicker --> KWS Source --> ChannelPicker --> KWS --> Alexa
  2. | /\
  3. V / \
  4. DOA Alexa Google Asissitant