Created
December 5, 2010 06:35
-
-
Save statonjr/728872 to your computer and use it in GitHub Desktop.
Nu function that wraps NSSpeechSynthesizer to act like AppleScript say function
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
#!/usr/local/bin/nush | |
(function say (something *voice) | |
(if (*voice) | |
(set s ((NSSpeechSynthesizer alloc) initWithVoice:("com.apple.speech.synthesis.voice." stringByAppendingString:(car *voice)))) | |
(else | |
(set s ((NSSpeechSynthesizer alloc) init)))) | |
(s startSpeakingString:something) | |
(while (s isSpeaking) | |
(sleep 1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment