Skip to content

Instantly share code, notes, and snippets.

@joshcampbell
Created March 14, 2016 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshcampbell/9e01d30605873a44b760 to your computer and use it in GitHub Desktop.
Save joshcampbell/9e01d30605873a44b760 to your computer and use it in GitHub Desktop.
from subprocess import Popen
class Voice:
def __init__(self):
self.subprocess = None
def say(self,quote):
self.stop()
self.subprocess = Popen(["espeak",quote])
def stop(self):
if self.subprocess != None:
# FIXME how do we know the process really terminated?
self.subprocess.kill()
self.subprocess = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment