text to speech python import os code example
Example 1: python text to speech
The best library because you dont have to save the
text file or open the file to start the speech
pip install pyttsx3
import pyttsx3
engine = pyttsx3.init()
engine.say("Hello world")
engine.runAndWait()
Example 2: text to sound python
#pip3 install pyttsx3
#apt-get install alsa-utils
import pyttsx3, time
engine = pyttsx3.init()
engine.say("Hi, I am text to speach")
engine.runAndWait()