lkuza2 / java-speech-api

The J.A.R.V.I.S. Speech API is designed to be simple and efficient, using the speech engines created by Google to provide functionality for parts of the API. Essentially, it is an API written in Java, including a recognizer, synthesizer, and a microphone capture utility. The project uses Google services for the synthesizer and recognizer. While this requires an Internet connection, it provides a complete, modern, and fully functional speech API in Java.
GNU General Public License v3.0
534 stars 301 forks source link

Suggestion to stream audio to GoogleSpeechAPI #42

Closed willondubs closed 10 years ago

willondubs commented 10 years ago

Just making a suggestion that you could increase the efficiency of your program by streaming audio directly to GoogleSpeechAPIv2. Below is a working nodejs proof-of-concept. I'm still trying to make a Python variant. And I'm looking forward to trying your project on a RaspberryPi.

var request = require("request"); var rec = require('node-record-lpcm16'); rec.start({ sampleRate : 16000, verbose : true }).pipe(request.post({ 'url' : 'https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key=apikeyhere', 'headers' : { 'Content-Type' : 'audio/l16; rate=16000;' } }, exports.parseResult)); }

Skylion007 commented 10 years ago

Thought I'd give you an update on how the implementation is coming along.

Thanks for the suggestion. I've been working on implementing it, but I am struggling to figure out an intuitive method structure for the duplex API. You can already sort of do it using a byte buffer anyhow. To implement it as you have suggested would just take rewriting a large portion of the API and designing a custom microphone interface and the like.

If you are referring to the Duplex API. We already have that implemented.

Skylion007 commented 10 years ago

Update: Streaming audio from the Microphone is now functional. See latest commit.