diff --git a/Python/Text to speech using windows in feature.py b/Python/Text to speech using windows in feature.py index 919df73..006c055 100644 --- a/Python/Text to speech using windows in feature.py +++ b/Python/Text to speech using windows in feature.py @@ -2,10 +2,22 @@ python program in windows 10 for convert text to speech using windows inbuilt feature. ''' +import pyttsx3 #pip install pyttsx3 -import win32com.client as wincl -speak = wincl.Dispatch("SAPI.SpVoice") -speak.Speak("Text To Speech") +#initializing the speak engine +speaker = pyttsx3.init('sapi5') +voices = speaker.getProperty('voices') +speaker.setProperty('voice', voices[1].id) # 0 for male voice and 1 for female voice + +#defining the speak function +def speak(text): + speaker.say(audio) + speaker.runAndWait() + +speak("Hello this code uses windows inbuilt feature to convert text to speech") + + +''' + +This Program is contributed by https://github.com/VishankSingh ''' -This Program is not complete yet -''' \ No newline at end of file