RiayatechChatDoctor / DocVoice.py
Muhammadidrees's picture
Upload 4 files
0329fd9 verified
raw
history blame
401 Bytes
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.")