Saturday, October 12, 2024

Text to Speech using Python (doesn't save, but good performance)

import pyttsx3


def text_to_speech(text):

    engine = pyttsx3.init()                     # Initialize engine

    engine.setProperty('rate', 300)             # Speed of speech


    voices = engine.getProperty('voices')

    engine.setProperty('voice', voices[1].id)  # 0 male, 1 female


    engine.say(text)

    engine.runAndWait()


text = '''



'''

text_to_speech(text)


No comments:

Post a Comment