Text to speech (TTS) is the conversion of written text into spoken voice.You can create TTS programs in python. The quality of the spoken voice depends on your speech engine.
In this article you’ll learn how to create your own TTS program.
Related course: Complete Python Bootcamp: Go from zero to hero in Python
The program ‘espeak’ is a simple speech synthesizer which converst written text into spoken voice. The espeak program does sound a bit robotic, but its simple enough to build a basic program.
Google has a very natural sounding voices. You can use their TTS engine with the code below.
For this program you need the module gTTS installed as well as the program mpg123.
# need gTTS and mpg123
This will output spoken voice / an mp3 file.