python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

speech stop listening after few seconds

Open heroddaji opened this issue 10 years ago • 2 comments

So I manage to make speech works on my rpi3 using the sample code speech_streaming.py. But I want my program always listen for a long period of time (days).

But the sample code seem to be able to listen for brief moment after it start-ups. I speak a few sentences, then I silent for a few secs, then in the transcript response, I will see the accuracy value. After that, the program stop listening, but the app does not quit, it just stay there

So is their a way to make the script listen forever? and if there is no way to do it, can I constantly reset the request every few seconds, then there is alway listening thread?

Also my concern is when I reset the listening thread and there is no sound to recognize, will it count as 1 speech_api request?

heroddaji avatar Aug 08 '16 05:08 heroddaji

Out of curiosity - what did you end up having to tweak to get things running on the rpi?

Take a look at the usage limits. Basically, it'll only recognize for a minute at a time. What you could do is to detect silences, and only start streaming audio to the api when there's someone speaking, and close the connection once you detect silence again (after some pause, presumably, to allow for folks taking a breath or whatnot).

jerjou avatar Aug 08 '16 18:08 jerjou

thank you for your answer. So when you say it'll only recognize for a minute, you mean at one time or many time?

  • so can I speak many times during one minute and get recognized, - or just one time speak, but with maximum duration of 1 minute?

heroddaji avatar Aug 09 '16 05:08 heroddaji