[Python] How to add your own tts voices for pyttsx3 python

Discussão em 'Python' iniciado por Stack, Abril 20, 2025.

  1. Stack

    Stack Membro Participativo

    So I have made a personal voice assistant in Python and it speaks currently with Microsoft David. There are some prebuilt voices to microsoft and you can add some more from settings and speech settings but not your own. I have two text to speech voices and one of them is what i want. So how do i select that voice? Here is code:

    import pyttsx3
    Assistant = pyttsx3.init('sapi5')
    voices = Assistant.getProperty('voices')
    Assistant.setProperty('voices', voices[0].id)
    Assistant.setProperty('rate', 180)

    def Speak(audio):
    print(" ")
    Assistant.say(audio)
    print(f"JARVIS: {audio}")
    print(" ")
    Assistant.runAndWait()

    Continue reading...

Compartilhe esta Página