text to speech offline

Solutions on MaxInterview for text to speech offline by the best coders in the world

showing results for - "text to speech offline"
Giovanni
09 Aug 2020
1import pyttsx3
2
3engine = pyttsx3.init('sapi5')
4voices = engine.getProperty('voices')
5# you can use print(voices) to see how many voices you have installed
6# print(voices[0].id)
7# print(voices[1].id)
8# print(voices[2].id)
9print(voices)
10engine.setProperty('voices', voices[0].id)
11
12def speak(audio):
13  	print(audio)
14    engine.say(audio)
15    engine.runAndWait()
16    
17speak('Hello')