I am trying to create a voice assistant using, gtts(Google text to speech).
I tried doing this but for audio output, it was able to write something that first saves the file and then plays it using audio player (in ubuntu), how to make it in the way it just speaks rather than saving it just like it does using engine.say() in pyttsx3
def speak(temp):
voice = gTTS(text=temp, lang="en")
voice.save("/home/vikrant/temp.mp3")
opener ="open" if sys.platform == "darwin" else "xdg-open"
subprocess.call([opener, "/home/vikrant/temp.mp3"])
It saves the file and plays it using audio player, I just want to play it directly because it doesn't make sense for the assistant to open player every time to speak something.