def speak(self, whattosay):
"""
Converts text to speech
:param whattosay: Text to speak
"""
print (self.name.upper() + " > " + whattosay)
audio_file = "response.mp3"
tts = gTTS(text=str(whattosay), lang="en")
tts.save(audio_file)
self.playsound(audio_file)
os.remove(audio_file)
评论列表
文章目录