Skip to content

Instantly share code, notes, and snippets.

@gkfarwaha
Created October 15, 2020 09:14
Show Gist options
  • Save gkfarwaha/10971016abf16c881a9c669cb2ee9772 to your computer and use it in GitHub Desktop.
Save gkfarwaha/10971016abf16c881a9c669cb2ee9772 to your computer and use it in GitHub Desktop.
input text to audio file
from gtts import gTTS
import os
str = input("Please enter the text to convert it into audio file \n", ) # taking input from the user to convert it into audio file
txt = str
# txt="hello world"
lan = 'en'
output = gTTS(text=txt, lang=lan, slow=False)
output.save("txt2sph.mp3")
os.system("start txt2sph.mp3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment