All Projects → spokestack → Spokestack Python

spokestack / Spokestack Python

Licence: apache-2.0
Spokestack is a library that allows a user to easily incorporate a voice interface into any Python application.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Spokestack Python

spokestack-android
Extensible Android mobile voice framework: wakeword, ASR, NLU, and TTS. Easily add voice to any Android app!
Stars: ✭ 52 (-49.51%)
Mutual labels:  text-to-speech, nlu, tts, speech-synthesis, voice-recognition, speech-recognition, natural-language-understanding
react-native-spokestack
Spokestack: give your React Native app a voice interface!
Stars: ✭ 53 (-48.54%)
Mutual labels:  text-to-speech, nlu, tts, speech-synthesis, voice-recognition, speech-recognition, speech-to-text
open-speech-corpora
💎 A list of accessible speech corpora for ASR, TTS, and other Speech Technologies
Stars: ✭ 841 (+716.5%)
Mutual labels:  text-to-speech, tts, speech-synthesis, voice-recognition, speech-recognition, speech-to-text
spokestack-ios
Spokestack: give your iOS app a voice interface!
Stars: ✭ 27 (-73.79%)
Mutual labels:  text-to-speech, speech-synthesis, voice-recognition, speech-recognition, speech-to-text, natural-language-understanding
Awesome Ai Services
An overview of the AI-as-a-service landscape
Stars: ✭ 133 (+29.13%)
Mutual labels:  natural-language-processing, speech-recognition, speech-to-text, speech-synthesis, text-to-speech
AmazonSpeechTranslator
End-to-end Solution for Speech Recognition, Text Translation, and Text-to-Speech for iOS using Amazon Translate and Amazon Polly as AWS Machine Learning managed services.
Stars: ✭ 50 (-51.46%)
Mutual labels:  text-to-speech, speech-synthesis, voice-recognition, speech-recognition, speech-to-text
Naomi
The Naomi Project is an open source, technology agnostic platform for developing always-on, voice-controlled applications!
Stars: ✭ 171 (+66.02%)
Mutual labels:  raspberry-pi, speech-recognition, speech-to-text, speech-synthesis, text-to-speech
Rhino
On-device speech-to-intent engine powered by deep learning
Stars: ✭ 406 (+294.17%)
Mutual labels:  raspberry-pi, speech-recognition, speech-to-text, natural-language-understanding, voice-recognition
Nemo
NeMo: a toolkit for conversational AI
Stars: ✭ 3,685 (+3477.67%)
Mutual labels:  speech-recognition, text-to-speech, speech-synthesis, speech-to-text
Kalliope
Kalliope is a framework that will help you to create your own personal assistant.
Stars: ✭ 1,509 (+1365.05%)
Mutual labels:  bot, speech-recognition, speech-to-text, speech-synthesis
Lingvo
Lingvo
Stars: ✭ 2,361 (+2192.23%)
Mutual labels:  speech-recognition, speech-to-text, speech-synthesis, tts
web-speech-cognitive-services
Polyfill Web Speech API with Cognitive Services Bing Speech for both speech-to-text and text-to-speech service.
Stars: ✭ 35 (-66.02%)
Mutual labels:  text-to-speech, speech-synthesis, speech-recognition, speech-to-text
leon
🧠 Leon is your open-source personal assistant.
Stars: ✭ 8,560 (+8210.68%)
Mutual labels:  text-to-speech, speech-synthesis, speech-recognition, speech-to-text
Deepspeech
DeepSpeech is an open source embedded (offline, on-device) speech-to-text engine which can run in real time on devices ranging from a Raspberry Pi 4 to high power GPU servers.
Stars: ✭ 18,680 (+18035.92%)
Mutual labels:  neural-networks, speech-recognition, speech-to-text, embedded
Cheetah
On-device streaming speech-to-text engine powered by deep learning
Stars: ✭ 383 (+271.84%)
Mutual labels:  raspberry-pi, speech-recognition, speech-to-text, voice-recognition
Vosk Api
Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Stars: ✭ 1,357 (+1217.48%)
Mutual labels:  raspberry-pi, speech-recognition, speech-to-text, voice-recognition
Clause
🏇 聊天机器人,自然语言理解,语义理解
Stars: ✭ 323 (+213.59%)
Mutual labels:  bot, natural-language-processing, natural-language-understanding, nlu
Botlibre
An open platform for artificial intelligence, chat bots, virtual agents, social media automation, and live chat automation.
Stars: ✭ 412 (+300%)
Mutual labels:  bot, natural-language-processing, natural-language-understanding, nlu
Openseq2seq
Toolkit for efficient experimentation with Speech Recognition, Text2Speech and NLP
Stars: ✭ 1,378 (+1237.86%)
Mutual labels:  speech-recognition, speech-to-text, speech-synthesis, text-to-speech
Speech And Text
Speech to text (PocketSphinx, Iflytex API, Baidu API) and text to speech (pyttsx3) | 语音转文字(PocketSphinx、百度 API、科大讯飞 API)和文字转语音(pyttsx3)
Stars: ✭ 102 (-0.97%)
Mutual labels:  speech-recognition, speech-to-text, text-to-speech

Spokestack Python

GitHub license CircleCI PyPI version Coverage Status

Welcome to Spokestack Python! This library is intended for developing voice interfaces in Python. This can include anything from Raspberry Pi applications like traditional smart speakers to Django web applications. Anything built in Python can be given a voice interface.

Get Started

System Dependencies

There are some system dependencies that need to be downloaded in order to install spokestack via pip.

macOS

brew install lame portaudio

Debian/Ubuntu

sudo apt-get install portaudio19-dev libmp3lame-dev

Windows

We currently do not support Windows 10 natively, and recommend you install Windows Subsystem for Linux (WSL) with the Debian dependencies. However, if you would like to work on native Windows support, we will gladly accept pull requests.

Another potential avenue for using spokestack on Windows 10 is from anaconda. This is without support for Text To Speech (TTS) though due to the Lame dependency. PortAudio, on the other hand, can be installed via conda.

conda install portaudio

Installation with pip

Once system dependencies have been satisfied, you can install the library with the following.

pip install spokestack

Setup

We use pyenv for virtual environments. Below you will find the step-by-step commands to install a virtual environment.

pyenv install 3.8.6
pyenv virtualenv 3.8.6 spokestack
pyenv local spokestack
pip install -r requirements.txt

Install Tensorflow

This library requires a way to run TFLite models. There are two ways to add this ability. The first is installing the full Tensorflow library.

The full Tensorflow package is installed with the following:

pip install tensorflow

TFLite Interpreter (Embedded Devices)

In use cases where you require a small footprint, such as on a Raspberry Pi or similar embedded devices, you will want to install the TFLite Interpreter. You can install it for your platform by following the instructions.

Usage

Speech Pipeline

The Speech Pipeline is the module that ties together VAD (voice activity detection), wakeword, and ASR (automated speech detection). The VAD listens to a frame of audio captured by the input device to determine if speech is present. If it is, the wakeword model processes subsequent frames of audio looking for the keyword it has been trained to recognize. If the keyword is found, the pipeline is activated and performs speech recognition, converting the subsequent audio into a transcript. The Speech Pipeline is initialized like this:

from spokestack.io.pyaudio import PyAudioInput
from spokestack.pipeline import SpeechPipeline
from spokestack.vad.webrtc import VoiceActivityDetector
from spokestack.wakeword.tflite import WakewordTrigger
from spokestack.asr.spokestack.speech_recognizer import SpeechRecognizer

mic = PyAudioInput()
vad = VoiceActivityDetector()
wake = WakewordTrigger("path_to_tflite_model")
asr = SpeechRecognizer("spokestack_id", "spokestack_secret")


pipeline = SpeechPipeline(mic, [vad, wake, asr])
pipeline.start()
pipeline.run()

Now that the pipeline is running, it becomes important to access the results from processes at certain events. For example, when speech is recognized there is a recognize event. These events allow code to be executed outside the pipeline in response. The process of registering a response is done with a pipeline callback, which we will cover in the next section.

Pipeline Callbacks

Pipeline callbacks allow additional code to be executed when a speech event is detected. For example, we can print when the pipeline is activated by registering a function with the pipeline.event decorator.

@pipeline.event
def on_activate(context):
    print(context.is_active)

One of the most important use cases for a pipeline callback is accessing the ASR transcript for additional processing by the NLU. The transcript is accessed with the following:

@pipeline.event
def on_recognize(context):
    print(context.transcript)

Natural Language Understanding (NLU)

Natural Language Understanding turns an utterance into structured data a machine can act on. For our purposes, this is joint intent detection and slot filling. You can read more about the concepts here. We like to think of intents as the action a user desires from an application, and slots as the optional arguments to fulfill the requested action. Our NLU model is initialized like this:

from spokestack.nlu.tflite import TFLiteNLU

nlu = TFLiteNLU("path_to_tflite_model")

Now that the NLU is initialized we can go ahead and add that part to the callback.

@pipeline.event
def on_recognize(context):
    results = nlu(context.transcript)

Text To Speech (TTS)

Text To Speech, as the name implies, converts text into spoken audio. This the method for giving your application a voice. We provide one TTS voice for free when you sign up for a Spokestack account, but you can contact us to train a truly custom voice. The TTS API keys are the same as SpeechRecognizer. The basic TTS initialization is the following:

from spokestack.tts.manager import TextToSpeechManager
from spokestack.tts.clients.spokestack import TextToSpeechClient
from spokestack.io.pyaudio import PyAudioOutput

client = TextToSpeechClient("spokestack_id", "spokestack_secret")
output = PyAudioOutput()
manager = TextToSpeechManager(client, output)
manager.synthesize("welcome to spokestack")

To demonstrate a simple TTS callback let's set up something that reads back what the ASR recognized:

@pipeline.event
def on_recognize(context):
    manager.synthesize(context.transcript)

Documentation

Build the docs

From the root project directory:

cd docs
make clean && make html

Deployment

This project is distributed using PyPI. The following is the command to build for installation.

python setup.py clean --all; rm -r ./dist
python setup.py sdist bdist_wheel

Twine is used to upload the wheel and source distribution.

twine upload dist/*

License

Copyright 2020 Spokestack, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License here

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].