This could be because you havent added a speech element or the text is not recognized. Actually there could be other issues as well, with the rest of the code and not this particular one. I recently tried to develop a chatbot and had converted text to speech. In that I had given the text to speech as 2 options. 1. Online text to speech, 2. Offline text to speech. The codes were entirely different for both. So you will have to specify if this is for online ot offline. For online you can import gtts from playsound import playsound # make request to google to get synthesis
tts = gtts.gTTS("Hello world") import gtts
from playsound import playsound It's pretty straightforward to use this library, you just need to pass text to gTTS object that is an interface to Google Translate's Text to Speech API: If your are building a bot then check out Chatbot development services. There are several consulants who can actually help you with this.
... View more