The control issues are tricky, because you’re dealing with what amounts to an external program (Apple’s TTS engine) to which we have relatively crude access through the say command.Įverything you can do with the command is documented, enter man say in a terminal window to see Apple’s docs. Instead, you can access the methods any time without any prior instantiation using static style syntax, e.g. I’ve set it up for static access, which means that you should never need to instantiate the class by calling something like TextToSpeech tts = new TextToSpeech() - and in fact that would be a Bad Idea. Note that the since the class is quite simple and really just wraps up a few functions. (I think the list of voices has changed since 10.5.)
MAC OS X TTS WHISPER MAC OS
It only works on Mac OS, won’t work in a web applet, and has only been tested in Mac OS 10.6. I’ve put together a small Processing class that makes it easy to add speech to your Processing sketches. command line instruction in a string object, pass that into the runtime execution thing, which in turn handles the TTS conversion. So to invoke the TTS engine from a Processing sketch, we can just create the say. By calling Runtime.getRuntime().exec("some command") we can run any code we want on the terminal from within Processing.
So that’s great, now what if we wanted to make a Processing sketch talk to us? In Java, as in most languages, there are ways to send commands to the terminal programmatically. It’s super simple to use, just type the command and then the text you want, e.g. Seems grim, but we’re in luck - Apple, in their infinite generosity, have given us a command line program called “say”, which lets us invoke the TTS engine through the terminal. via a menu command in TextEdit, or system-wide through the accessibility settings. The Mac has a really great text-so-speech ( TTS) engine built right in, but at first glance it’s only available at Apple’s whim in specific contexts - e.g.