Skip to content

Instantly share code, notes, and snippets.

@zakirangwala
Last active September 23, 2020 12:32
Show Gist options
  • Save zakirangwala/7ca3f8a771058ede2c95e3f0b454e66d to your computer and use it in GitHub Desktop.
Save zakirangwala/7ca3f8a771058ede2c95e3f0b454e66d to your computer and use it in GitHub Desktop.
Tutorial code : Speak Function using the pyttsx3 package
import pyttsx3
# Initialize Text to Speech
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
# Speak Function
def speak(audio):
engine.say(audio)
engine.runAndWait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment