• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

respeaker/respeaker_python_library: To build voice enabled objects/applications ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

respeaker/respeaker_python_library

开源软件地址(OpenSource Url):

https://github.com/respeaker/respeaker_python_library

开源编程语言(OpenSource Language):

Python 100.0%

开源软件介绍(OpenSource Introduction):

ReSpeaker Python Library

Build Status

ReSpeaker is an open project to create voice enabled objects. ReSpeaker python library is an open source python library to provide basic functions of voice interaction.

It uses PocketSphinx for keyword spotting and uses webrtcvad for voice activity detecting.

Installation (Not for ReSpeaker Core)

Note: This library is already installed on ReSpeaker Core by default. Please skip the installation step and don't re-install it

python and pip are required.

  1. Install pocketsphinx, webrtcvad

On windows, we can use pre-compiled python wheel packages of pocketsphinx and pyaudio from speech_recognition. For python 2.7, run:

pip install https://github.com/respeaker/respeaker_python_library/releases/download/v0.4.1/pocketsphinx-0.0.9-cp27-cp27m-win32.whl
pip install https://github.com/respeaker/respeaker_python_library/releases/download/v0.4.1/webrtcvad-2.0.9.dev0-cp27-cp27m-win32.whl

On Linux

pip install pocketsphinx webrtcvad
  1. pip install pyaudio respeaker --upgrade

  2. Install hidapi (optional)

MacOSX install ReSpeaker Python Library

0.(brew install python2)

1.pip2 install pocketsphinx webrtcvad

2.(Since pyAudio has portAudio as a dependency, you first have to install portaudio: brew install portaudio) pip install pyaudio respeaker --upgrade 3.Install hidapi (optional)

stdio.h file not found error on macOS Mojave

For anyone discovering this later on who may not be familiar with the command line, here's how to install the macOS_SDK_headers_for_macOS_10.14.pkg package as explained in @yicongli's response above:

In Terminal.app or any shell app like iTerm:

cd /Library/Developer/CommandLineTools/Packages/ open macOS_SDK_headers_for_macOS_10.14.pkg

Make sure you go through the whole thing and try to install the gem that failed to install again or run bundle install again if this was something you encountered while trying to install from a Gemfile.

Getting started

import logging
import time
from threading import Thread, Event

from respeaker import Microphone


def task(quit_event):
    mic = Microphone(quit_event=quit_event)

    while not quit_event.is_set():
        if mic.wakeup('respeaker'):
            print('Wake up')
            data = mic.listen()
            text = mic.recognize(data)
            if text:
                print('Recognized %s' % text)


def main():
    logging.basicConfig(level=logging.DEBUG)

    quit_event = Event()
    thread = Thread(target=task, args=(quit_event,))
    thread.daemon = True
    thread.start()
    while True:
        try:
            time.sleep(1)
        except KeyboardInterrupt:
            print('Quit')
            quit_event.set()
            break
    time.sleep(1)

if __name__ == '__main__':
    main()



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap