In my project, i have list of strings and a function that creates a text to speech audio file given a string. I also have a function that plays audio files. e.g.
string_list = ['example','strings']
def tts(string): tts
def play_audio(file): plays audio
The problem is combining these functions either:
Does not wait for the previous audio file to finish before playing the next.
Waits for the audio to finish playing before computing TTS.
The behavior I want is for the program to TTS a string and play the audio, and while the audio is playing it can start inferencing the second string to save a lot of time, but wait until the first file is done playing before playing the next. I have tried asyncio with some suggestions from AI, but nothing seems to be working.