Package com.sun.speech.freetts

Examples of com.sun.speech.freetts.Voice


    public static void listAllVoices() {
        System.out.println();
        System.out.println("All voices available:");
        VoiceManager voiceManager = VoiceManager.getInstance();
        Voice voices[] = voiceManager.getVoices();
        for (int i = 0; i < voices.length; i++)
            System.out.println("    " + voices[i].getName() + " (" + voices[i].getDomain() + " domain)");

    }
View Full Code Here


    public static void main(String args[]) {
        listAllVoices();
        System.out.println();
        VoiceManager voiceManager = VoiceManager.getInstance();
        Voice helloVoice = voiceManager.getVoice("kevin16");
        if (helloVoice == null) {
            System.exit(1);
        }
        helloVoice.allocate();
        helloVoice.speak("all over the world, you can see");
        helloVoice.deallocate();
        System.exit(0);
    }
View Full Code Here

    System.out.println("使用声音: " + voiceName);

    /* The VoiceManager manages all the voices for FreeTTS.
     */
    VoiceManager voiceManager = VoiceManager.getInstance();
    Voice helloVoice = voiceManager.getVoice(voiceName);

    if (helloVoice == null) {
      System.err.println( "找不到你所指定的声音. "  + voiceName + "请选择另一种.");
      System.exit(1);
    }

    /* Allocates the resources for the voice.
     */
    helloVoice.allocate();
    Locale a = helloVoice.getLocale();
    System.out.println(a.getLanguage());
    /* Synthesize speech.
     */
    helloVoice.speak(textTo);
    /* Clean up and leave.
     */
    helloVoice.deallocate();

  }
View Full Code Here

        System.out.println("Using voice: " + voiceName);

    /* The VoiceManager manages all the voices for FreeTTS.
    */
        VoiceManager voiceManager = VoiceManager.getInstance();
        Voice helloVoice = voiceManager.getVoice(voiceName);

        if (helloVoice == null) {
            System.err.println(
                    "Cannot find a voice named "
                            + voiceName + ".  Please specify a different voice.");
            System.exit(1);
        }
   
    /* Allocates the resources for the voice.
    */
        helloVoice.allocate();
   
    /* Synthesize speech.
    */
//     helloVoice.speak("Thank you for giving me a voice. "
//             + "I'm so glad to say hello to this world.");
        helloVoice.speak("How much wood could a woodchuck chuck if a woodchuck could chuck wood?");
        helloVoice.speak("The RDF Schema vocabulary (RDFS)");

    /* Clean up and leave.
    */
        helloVoice.deallocate();
        System.exit(0);
    }
View Full Code Here

   
    if(voiceName==null) {
      voiceName = "kevin16";
    }

    Voice voice = voices.get(voiceName);

    if(voice!=null) {
      if(!voice.isLoaded()) {
        voice.allocate();
      }
      voice.speak(text);
    } else {
      logger.error("Could not find voice: " + voiceName);
      StringBuilder sb = new StringBuilder();
      if(logger.isInfoEnabled()) {
        for(String name : voices.keySet()) {
View Full Code Here

TOP

Related Classes of com.sun.speech.freetts.Voice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.