Search code examples
pythonpyttsx3

TypeError: setProperty() takes 3 positional arguments but 4 were given error while using in pyttsx3


Pyttsx3 module error when I run this it gives me error. But I want to have female voice to be moderated ..how can I do it import speech_recognition as sr import pyttsx3

engine=pyttsx3.init('sapi5')
voices=engine.getProperty('voices')
engine.setProperty(voices[1].id,'rate',178)


def speak(text):
    engine.say(text)
    engine.runAndWait()
    speak("Hello welcome to Shimla Bank")

Solution

  • I think this is what you need:

    egnine.setProperty("voice", voices[1].id)
    engine.setProperty("rate", 178)