if self.new_responses:
if not self.vc.is_playing():
next_response = self.responses.pop(0)
self.vc.send_audio_packet(next_response['audio'])
# source = FFmpegPCMAudio(next_response['path'])
## source = FFmpegPCMAudio(next_response['audio']) # Doesnt work either
# self.vc.play(source)
if len(self.responses) == 0:
self.new_responses = False
The commented out code where it converts the file to source and plays it, works fine. But saving to wav is only for testing, I do not want to be using processing time on saving anything. Right now I take the audio bytearray directly and save it to wav, only to play it later and delete it. I should be able to take this audio data and play it directly without having to save it as a file first.
The documentation for send_audio_packet says "Sends an audio packet composed of the data."
The wav file I create the source material from, is created from the audio bytearray in next_response['audio'].
send_audio_packet says it accepts byte-like objects, which includes bytearrays. So I don't really understand why this is not working?
I have also tried passing the audio bytearray to the ffmpeg, but that didn't work either.
Help me please, I would really hate to have to save the generated audio when I can work directly with the bytearrays that I would be writing to the files anyway...