![]() |
VOOZH | about |
Text-to-Speech (TTS) means converting written text into spoken audio. In Python, one of the simplest libraries for this task is gTTS (Google Text-to-Speech).
Features of gTTS
To install the gTTS library, open the terminal or command prompt and run:
pip install gTTS
The basic syntax for gTTS is:
from gtts import gTTS
myobj = gTTS(text="Your text here", lang="en", slow=False)
myobj.save("output.mp3")
Parameters:
Example: This program converts text into speech, saves it as an MP3 file, and plays it using your system's default audio player.
Output
Explanation: