0 Replies Latest reply: Sep 4, 2009 3:32 AM by 843802 RSS

    Which laguages does FreeTTS Supported.

    843802
      Hi all !
      I want use FreeTTS for my application. I can use the code bellow to read the Hello World in English.

      How can i read another language for example German or French,...

      My code here :
      Can anybody help me ?

      //////////////////////////////////////////////////////////////////////////////////////////
      package com.myprj.demo;

      //Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 5/16/2009 1:26:02 PM
      //Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
      //Decompiler options: packimports(3)
      //Source File Name: HelloWorld.java

      import java.io.File;
      import java.io.PrintStream;
      import java.util.Locale;
      import javax.speech.Central;
      import javax.speech.EngineList;
      import javax.speech.synthesis.*;

      public class HelloWorld
      {

      public HelloWorld()
      {
      }

      private static String noSynthesizerMessage()
      {
      String message = "No synthesizer created. This may be the result of any\nnumber of problems. It's typically due to a missing\n\"speech.properties\" file that should be at either of\nthese locations: \n\n";
      message = message + "user.home : " + System.getProperty("user.home") + "\n";
      message = message + "java.home/lib: " + System.getProperty("java.home") + File.separator + "lib\n\n" + "Another cause of this problem might be corrupt or missing\n" + "voice jar files in the freetts lib directory. This problem\n" + "also sometimes arises when the freetts.jar file is corrupt\n" + "or missing. Sorry about that. Please check for these\n" + "various conditions and then try again.\n";
      return message;
      }

      public static void listAllVoices(String modeName)
      {
      System.out.println();
      System.out.println("All " + modeName + " Mode JSAPI Synthesizers and Voices:");
      SynthesizerModeDesc required = new SynthesizerModeDesc(null, modeName, Locale.US, null, null);
      EngineList engineList = Central.availableSynthesizers(required);
      for(int i = 0; i < engineList.size(); i++)
      {
      SynthesizerModeDesc desc = (SynthesizerModeDesc)engineList.get(i);
      System.out.println(" " + desc.getEngineName() + " (mode=" + desc.getModeName() + ", locale=" + desc.getLocale() + "):");
      Voice voices[] = desc.getVoices();
      for(int j = 0; j < voices.length; j++)
      System.out.println(" " + voices[j].getName());

      }

      }

      public static void main(String args[])
      {
      listAllVoices("general");
      String voiceName = args.length <= 0 ? "kevin16" : args[0];
      System.out.println();
      System.out.println("Using voice: " + voiceName);
      try
      {
      SynthesizerModeDesc desc = new SynthesizerModeDesc(null, "general", Locale.US, null, null);
      Synthesizer synthesizer = Central.createSynthesizer(desc);
      if(synthesizer == null)
      {
      System.err.println(noSynthesizerMessage());
      System.exit(1);
      }
      synthesizer.allocate();


      synthesizer.resume();
      desc = (SynthesizerModeDesc)synthesizer.getEngineModeDesc();
      Voice voices[] = desc.getVoices();

      Voice voice = null;
      int i = 0;
      do
      {
      if(i >= voices.length)
      break;
      if(voices.getName().equals(voiceName))
      {
      voice = voices[i];

      break;
      }
      i++;
      } while(true);
      if(voice == null)
      {
      System.err.println("Synthesizer does not have a voice named " + voiceName + ".");
      System.exit(1);
      }
      synthesizer.getSynthesizerProperties().setVoice(voice);
      synthesizer.speakPlainText("Hello World!", null);
      synthesizer.waitEngineState(0x10000L);
      synthesizer.deallocate();
      System.exit(0);
      }
      catch(Exception e)
      {
      e.printStackTrace();
      }
      }
      }

      //////////////////////////////////////////////////////////////////////////////////////////

      Best regards!