1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Getting Started with Phonemic

The Phonemic library is a .jar file that must be included in your java project. The phonemic.jar file can be found under phonemic/dist. In addition to the phonemic.jar file, your program must include the appropriate JNI libraries for the various platforms you intend to support. These files can be found under phonemic/jni.

The Phonemic release includes a basic Netbeans project that can be used as a template for getting started.

Using Netbeans

If you wish to create a new project using Phonemic in Netbeans, here are the required steps:

  1. Create a new Java Application project.
  2. In the Projects Window, right click on "Libraries" and select "Add JAR/Folder."
  3. Browse to the location of "phonemic.jar." In the release, this is under phonemic/dist.
  4. Copy the contents of the phonemic/jni folder to some location that your project can reference. For example, in the example Netbeans project, it is located under $projectRoot/jni.
  5. Set up the java environment to point to your JNI folder location. This is necessary so that Phonemic can find all the .dll, .so and .dylib files it requires. This is done in the following way:
    1. Right click on your project in the Projects window and click on Properties.
    2. On the left, go to the Run section.
    3. Under VM Options, enter the following: -Djava.library.path="{your path}", with {your path} replaced with the appropriate directory. For example, in the included example project, the JNI libraries are included under the project root directory in a folder named "jni.". Thus, the correct VM Option would be -Djava.library.path="jni"
  6. Your environment should be set up correctly. See the "Example Code" section below.

Using other IDEs

The procedure for other Java IDEs will be similar, but the most important steps are to make sure your java project is referencing the phonemic.jar file, and that the VM option "java.library.path" is set correctly.

Example Code

Once your project is properly referencing phonemic.jar and the java.library.path VM option is set correctly, you can begin using the Phonemic library. All Phonemic code can be found under the namespace prefix org.sodbeans.phonemic. To use the basic features of Phonemic, you only need to include the following namespaces using this code:

import org.sodbeans.phonemic.*; // import for the TextToSpeechFactory, used to get an available text to speech engine.
import org.sodbeans.phonemic.tts.*; // import for the TextToSpeech interface, used to communicate with all speech engines.

Then, you must instantiate a TextToSpeech? object using the following code (inside your project's main method or some other routine):

// Get a text-to-speech object from Phonemic.
TextToSpeech speech = TextToSpeechFactory.getDefaultTextToSpeech();

Your code is now able to use the created speech object to interface with a Text to Speech engine using Phonemic. See the example Netbeans project in the release (under testApp/) for a simple example.