Friday, April 18, 2014

Python speech synthesis on OS X

I know, this is cheating. But it's fun.

def speak(*args):
    from subprocess import Popen, PIPE
    
    cmd = ["/usr/bin/say"]
    cmd.extend(args)
    
    Popen(cmd, stdout=PIPE, stderr=PIPE).communicate()

No comments:

Post a Comment