Skip to content

Instantly share code, notes, and snippets.

@phi-line
Last active October 19, 2018 20:42
Show Gist options
  • Save phi-line/03601e8f57a7f38c5b8f6261ed280958 to your computer and use it in GitHub Desktop.
Save phi-line/03601e8f57a7f38c5b8f6261ed280958 to your computer and use it in GitHub Desktop.
Simple coin toss
from subprocess import call
from gtts import gTTS
from random import randint, seed
import os
def flip():
text = ["It is heads", "It is tails"]
return text[randint(0,1)]
def main():
seed(None)
tts = gTTS(text=flip(), lang='en')
tts.save('flip.mp3')
call(["vlc",'flip.mp3','--qt-start-minimized','--play-and-exit'])
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment