Last active
September 23, 2020 12:33
-
-
Save zakirangwala/ec426644888617deb28a55fcaf2bd0d6 to your computer and use it in GitHub Desktop.
Tutorial code : Speak Function using the gTTS package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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