Skip to content

Instantly share code, notes, and snippets.

@zakirangwala
Last active September 23, 2020 12:33
Show Gist options
  • Save zakirangwala/ec426644888617deb28a55fcaf2bd0d6 to your computer and use it in GitHub Desktop.
Save zakirangwala/ec426644888617deb28a55fcaf2bd0d6 to your computer and use it in GitHub Desktop.
Tutorial code : Speak Function using the gTTS package
# Import required modules for Text to speech conversion
from gtts import gTTS
import playsound
import os
#Speak Function
def speak():
engine = gTTS(text='Hello World', lang='en', slow=False)
engine.save("speech.mp3")
playsound.playsound("speech.mp3")
os.remove("speech.mp3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment