Skip to content

Instantly share code, notes, and snippets.

@statonjr
Created December 5, 2010 06:35
Show Gist options
  • Save statonjr/728872 to your computer and use it in GitHub Desktop.
Save statonjr/728872 to your computer and use it in GitHub Desktop.
Nu function that wraps NSSpeechSynthesizer to act like AppleScript say function
#!/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