3 Replies Latest reply: Oct 22, 2010 12:16 AM by EJP RSS

    java speech api

    843802
      kindly suggest me where to get the java speech api
        • 1. Re: java speech api
          843802
          Java Speech is a specification and there are many implementations of it by different other people. one of it is FreeTTS.
          You can download it from
          http://freetts.sourceforge.net/docs/index.php
          • 2. Re: java speech api
            807275
            import javax.speech.*;
            import javax.speech.synthesis.*;
            import java.util.Locale;
            import java.util.*;
            import java.util.Scanner;
            
            public class HelloWorld {
                 public static void main(String args[]) {
                      String str = "";
                      System.out.print("Input Text: ");
                      Scanner input = new Scanner(System.in);
                      str = input.nextLine();
                      try {
                           System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");
                      // Create a synthesizer for English
                           Synthesizer synth = Central.createSynthesizer(
                           new SynthesizerModeDesc(Locale.ENGLISH));
            
                      // Get it ready to speak
                           synth.allocate();
                           synth.resume();
            
                      // Speak the “Hello world” string
                           synth.speakPlainText(str, null);
            
                      // Wait till speaking is done
                           synth.waitEngineState(Synthesizer.QUEUE_EMPTY);
                      // Clean up
                           synth.deallocate();
                      } 
                      catch (Exception e) {
                      e.printStackTrace();
                      }
                 }
            }
            Here's a sample program using FreeTTS.
            Instructions:
            1.Download FreeTTS from sourceforge.
            2.Extract files to some folder.
            3.Go to lib folder run jsapi.exe (it should extract jsapi.jar)
            4.Copy all jar file from lib directory to your java directory mine was C:\Program Files\Java\jdk1.6.0_22\jre\lib\ext
            5.compile then run the program.

            Edited by: Darryl Burke -- code tags added
            • 3. Re: java speech api
              EJP
              You are four years late. Locking.