Putting Speech to Work

Once you’ve decided that you want to play around with the speech API, it’s actually pretty simple to put it into action. This section will discuss how to put speech into basic dialog boxes, as well as more useful applications of text-to-speech and speech recognition.

Getting Set Up

As mentioned earlier, these steps assume that you are a member of the Apple Developer Connection (ADC), for which you can sign up for free. Visit https://connect.apple.com and log in to the developer connection. You’ll be given several menus and submenus on the left. Select “Download Software” and then “Java.” Then download the Speech Framework as a Mac binary file (in .dmg format). Once you have mounted the disk image, start the included installer.

The installer will place several items of interest on your disk. First, it will place a JAR file, JavaSpeechFramework.jar , in the standard extensions directory of your JavaVM.framework folder, at /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/lib/ext/ (see Chapter 2 for more information on the Mac OS X JVM directory layout). It will place documentation in the directory /Developer/Research/JavaSpeechFramework/Documentation/, and sample code in the directory /Developer/Research/JavaSpeechFramework/Examples/.

The JavaSpeechFramework.jar file, therefore, is of great interest. You’ll need to make sure this library is on the classpath for your compiler and application before you use the framework.

Tip

You can put this JAR ...

Get Mac OS X for Java Geeks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.