Search code examples
google-speech-api

Google Speech API Audio too slow in streaming mode


I am trying to pass my UDP audio data to Google Speech API and it works pretty well. However I got an issue:

When I start recognizing, I am waiting for packages, and thus no data is passed to Google Speech API. When packages come, I start sending them to API and it returns an error: Audio data is being streamed too slow. Please stream audio data approximately at real time. So, the problem is - when there is a delay after establishing the connection to Google Speech API and no data is sent before sending data start, it always leads to such behaviour.

Is it an intended behaviour or some workaround maybe?

Regards, Artemiy


Solution

  • We have seen this error when our application was too slow in feeding audio to the Google Speech platform or when there was an excessive delay among two consecutive writes:

    • You must be ready to start streaming of audio (writes of audio chunks) towards the Google Speech platform as soon as you send the initial Recognize
    • Your application must continue to feed audio to the Google Speech platform at a stable rate (e.g. if working with 8Khz audio x 8 bit, you must provide approximatively 8KB of audio each second, for example with consecutive writes of 4KB, delayed of about 0.5s)