Getting Started with Java Speech Applet Development
by Chris Robbins
Understanding the Java Speech API
I would first begin by going through the
Java Speech API (JSPAI) FAQ to gain a sense of Sun's role in its development versus
the role of the third party companies who actually implemented the API. This FAQ also
includes some useful links to the JSAPI Specification and the Java Speech Grammar Format
(JSGF) Specification, among others. Also, the FAQ concludes with "How do I use JSAPI in
an Applet", which will later serve as our guide for setting up the IBM VoiceServer SDK
to work as our Java Speech SDK and Recognition Engine:
Downloading and Installing a Voice Recognition SDK and Engine
Although, there does exist an IBM ViaVoice SDK for the purpose of developing Java Speech
applications and applets, this SDK is a commercial product which is made available by
Wizzard Software for downloading on only a 30-day trial basis.
An alternative solution is to use the completely free IBM VoiceServer SDK, which is a
development kit for designing and testing VoiceXML applications, but includes all of the
required components for developing Java Speech applets. The idea is to basically
download and install the IBM VoiceServer SDK as directed, but then use it per the JSAPI FAQ, instead of
the collection of, somewhat misleading, VoiceXML oriented instructions and guides provided
with the VoiceServer download.
Thus, after reading the JSAPI FAQ,
download the IBM WebSphere Voice Server SDK
Some notes on Installing the IBM VoiceServer SDK
- The VoiceServer SDK requires a Java 1.3 Runtime Environment. Newer or older JRE's will
be detected by the setup program which will then abort the installation. The download
includes a 1.3 JRE, which I would suggest using to assure compliance.
- Note that you can develop your Java Speech applets using any
version of the Java SDK and JRE. (I happen to use the Java 2 1.4.2 SDK. The FAQ provides
steps to support Java 1.1 from JRE 1.1.7 on up). However, the speech recognition engine
will continue to require the 1.3 JRE to run.
- Be sure to run the Audio Setup application, which is installed along with the SDK, to
callibrate your microphone and accomodate for background noise.
Some notes on Compiling and Running Applets with Speech Recognition:
- All of the classes required to develop a Java Speech applet, which only utilizes speech
recognition, are in the 'ibmjs.jar' file. The other JAR files and the Java Media Framework
API (JMF2.0) pertain to VoiceXML and speech synthesis respectively, and can be
disregarded.
- The following steps are included in the "How to..." section of the JSAPI FAQ, but are being repeated
for the purpose of providing example paths based upon a default installation of the Voice Server SDK on
a Windows 2000/XP system:
- To compile your Java Speech applet just ensure that the ibmjs.jar file is in your CLASSPATH.
For my installation the default location for the IBM Java Speach JAR was:
C:\Program Files\VoiceServerSDK\lib\ibmjs.jar
- To run a Java Speech Applet in your browser, your Windows PATH environment variable needs to
include the path for the ibmreco.dll, (default location - C:\Program Files\VoiceServerSDK\lib\),
and the path for the recognition engine (default location - C:\Program Files\VoiceServerSDK\ViaVoice\bin\).
Also ensure that your Windows CLASSPATH environment variable includes the path for the ibmjs.jar.
- Update the VM java runtime parameters by adding -Djava.class.path=C:\PROGRA~1\VoiceServerSDK\lib\ibmjs.jar
- Please follow all of the steps in the FAQ. The speech.properties file and security policy files are required.
Designing and Developing Your Java Speech Applet
Once you have a working development environment, please refer to the following tutorial, as it is a indispensible
overview of the architecture and usage of the Java Speech SDK.
LINUX JOURNAL: Java Speech Development Kit: A Tutorial
Some Useful Links