Skip to content

Instantly share code, notes, and snippets.

@anupam-io
Created February 27, 2021 10:44
Show Gist options
  • Save anupam-io/384d524e17466251dd87a74627c1cd0b to your computer and use it in GitHub Desktop.
Save anupam-io/384d524e17466251dd87a74627c1cd0b to your computer and use it in GitHub Desktop.
Voice logging function in Python using gTTS
def vlog(s):
s = str(s)
from gtts import gTTS
from os import system
language = 'en'
output = gTTS(text=s, lang=language, slow=False)
system("mkdir -p .vlogs")
output.save("./.vlogs/output.mp3")
system("ffplay -nodisp -autoexit ./.vlogs/output.mp3 >/dev/null 2>&1")
vlog("""SyntaxError: invalid syntax""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment