I am trying to stream audio in a Int16 array format from Flask server to Google Cloud Speech Api. For some reason it's silently failing, probably it has something to do with how I'm using the stream generator or sending the data in a wrong forma
Google Cloud Documentation says that stream should be a generator yielding chunks of audio data. Not very explicit, I tried building a generator.
Why I'm not getting response from google cloud?
This is the main code
total_msg = ""
sample_rate = 16000
msg = ws.receive()
if msg is not None:
audio_as_int_array = numpy.frombuffer(msg, 'i2')
stream = [generator()]
requests = (types.StreamingRecognizeRequest(audio_content=chunk)
for chunk in stream)
language_code = 'en-US' # a BCP-47 language tag
client = speech.SpeechClient()
config = types.RecognitionConfig(
streaming_config = types.StreamingRecognitionConfig(