Hi. I have Text-to-Speech generating a response. I can save this as an mp3 file and play that file. That works.
What I want to do is to live stream/play the returned Speech.
I've seen the following, but the first line (io.BytesIO) generates an error
TypeError: a bytes-like object is required, not 'Response'
from pydub import AudioSegment
import sounddevice
import io
import numpy as np
mp3_bytes = io.BytesIO(speech_response.data)
audio = AudioSegment.from_file(mp3_bytes, format="mp3")
>>TypeError: a bytes-like object is required, not 'Response'
Any ideas what is needed here or how to get this to live stream the response (speech_response.data)
I can save speech_response.data to a file, with mp3 extension. Read that file and play it. That works. I've trying to avoid the write/read to/from file step.