Python Forum
working with pyttsx3 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: working with pyttsx3 (/thread-31118.html)



working with pyttsx3 - gr3yali3n - Nov-24-2020

i have been messing around with text the speech module pyttsx3, I have two computers that I am working with, one is a mac and the other is a linux the voice id 14 on the mac is ideal but the voice id 14 on the linux is horrid.
i got to looking into this and i think its because of the nssSpeech synthesizer is on the mac and Espeak is on linux. so i guess its espeak that has terrible voices, so i found flite , it had a usable voice but i couldnt find a way to pip install that...
i went over to pyttsx3 doc page trying to figure out the proper syntax but i didnt fully understand it....
what i am wondering is can i assign flite or any other speech synthesizer as the driver for the pyttsx3 engine? here is what ive tried that didnt work...

 
import pyttsx3


engine = pyttsx3.init('flite')
voice = engine.getProperty("voices")
engine.setProperty('voice',voice[14].id)
newvoiceRate = 135
engine.setProperty('rate' , newvoiceRate)


def speak(audio):
    engine.say(audio)
    engine.runAndWait()


speak("hello, this is my voice , this isnt quite the voice that you want.")