Spaces:
Build error
Build error
File size: 401 Bytes
0329fd9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import pyttsx3
def text_to_speech(text: str):
# Initialize engine
engine = pyttsx3.init()
# Use default voice
engine.setProperty('voice', engine.getProperty('voices')[0].id)
# Speak the text
engine.say(text)
engine.runAndWait()
# Example usage
if __name__ == "__main__":
text_to_speech("Hello Abdul Moiz! This is your Riaya Tech project speaking.")
|