Giter Site home page Giter Site logo

speechtotext's Introduction

Speech-to-Text GRPC Microservice

Bi-directional streaming speech-to-text (STT or ASR) micro-service that proxies cloud ASRs: Google Cloud Speech, IBM Bluemix STT speech and Hound STT. To avoid cloud ASR from abruptly asserting end-of-speech, we implement custom voice-activity detection (VAD) with tunable activity threshold.

Install dependicies

Preferred way is to do in virtualenv (Python 2.7).

pip install --upgrade pip
pip install -r requirements.txt

Compile .proto

cd proto
bash generate_pb.sh

Proxy server

Credentials

Google ASR

Download the service account key for Google Cloud Speech and move it to asr/google_key.json. Run the following command in the terminal to set the Google ASR credential path

export GOOGLE_APPLICATION_CREDENTIALS=asr/google_key.json

Hound ASR

Add clientID and ClientKey for Hound STT under asr/hound_key.json

IBM ASR

Add credentials for IBM Bluemix STT under asr/ibm_key.json

Database

Uses local log directory.

Create log directory

Create log folder and log/log.json file with empty ({}) json contents.

Start server

Start the server on a given port. Running on ports below 1024 requires root privileges.

python stt_server.py -p 9080

Proxy Client

Configuration

Edit settings.json to specify the ASR settings.

Stream from recorded file

python test_stt_client.py -p 9080 -in audio/whatistheweatherthere.wav

Stream from microphone (MAC OS)

Requires sox.

rec -p -q | sox - -c 1 -r 16000 -t s16 -q -L - | python test_stt_client.py -p 9080 -in stdin

Long running speech

Set continuous: true and chunksize: 3072 (byte size of audio chunk) in settings.json for continuous long running speech (capped at ~1min). WebRTC VAD is utilized for silence detection.

Running client

python test_stt_client.py -p 9080 -in audio/whatistheweatherthere.wav

shows the following output

############### google ASR ################
what is the weather there***


############### hound ASR ################
what is the weather there***


############### ibm ASR ################
what is the weather there ***

Response format

Return type to the client is a stream of JSON responses like:

{
	"asr": "google",
	"transcript": "what is the weather there"
	"is_final": False
  }

Testing

Individual ASR blocks (XXX = goog, ibm, hound) can be tsted locally as follows. For Google make sure the credentials are exported. python -m asr.XXX -in audio/whatistheweatherthere.wav

speechtotext's People

Contributors

gkchai avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.