Created
August 20, 2012 16:24
-
-
Save tgck/3405500 to your computer and use it in GitHub Desktop.
simpleSpeakSynthesizer2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# every time another person speaks! | |
from AppKit import NSSpeechSynthesizer | |
import random | |
voices = NSSpeechSynthesizer.availableVoices() | |
voices = [x.split(".")[-1] for x in voices] | |
def speak(txt): | |
voice = "com.apple.speech.synthesis.voice." + voices[random.randint(0,len(voices))] | |
speech = NSSpeechSynthesizer.alloc().initWithVoice_(voice) | |
speech.startSpeakingString_(txt); | |
speak("Helloooooooooooooooooooo!!!!"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment