I'm trying to use google's speech-to-text api, but I am stuck at this part where I need to pass audio content in the speech.RecognitionAudio()
audio = speech.RecognitionAudio(uri=gcs_uri)
with base64 of audio which I will receive through my API response, but here I'm trying to mimic this API behavior by reading and converting an audio file(.m4a) to wav (which is already base64 by default).
with io.open(stream_file, "rb") as audio_file:
content = audio_file.read()
audio = speech.RecognitionAudio(content)
resulting in TypeError: Invalid constructor input for RecognitionAudio:b'AAAAGGZ0eXBtcDQyAAAAAG1wNDFpc29tAAAAKHV1aWRcpwj7Mo5CBahhZQ7KCpWWAAAADDEwLjAuM...
As the docs says
I am doing the same thing but still failing, maybe I'm not understanding it properly.
Please help here. Thanks
It seems I have to pass the content defining what I'm passing
audio = speech.RecognitionAudio(content=audio64)
wasted my 3-4 hours on just this figuring out, hopefully, someone will find this helpful.