Package javax.speech.synthesis

Examples of javax.speech.synthesis.Voice


//    }
   
   
    System.out.println(" ** Loading tts **");
    // kevinHQ in a 16khz unlimited-domain diphone voice
    Voice kevinHQ = new Voice("kevin16",Voice.GENDER_DONT_CARE, Voice.AGE_DONT_CARE, null);
     
    // Create a new SynthesizerModeDesc that will match the
    // Unlimited domain FreeTTS Synthesizer.
   
    SynthesizerModeDesc unlimitedDesc =
View Full Code Here


    /**
     * Creates and loads the synthesizer.
     */
    private void loadSynthesizer(String voiceName) {

        voice = new Voice(voiceName,
        Voice.GENDER_DONT_CARE,
        Voice.AGE_DONT_CARE,
        null);

  SynthesizerModeDesc modeDesc = new SynthesizerModeDesc(
View Full Code Here

  System.out.println(" ** Mixed Voices - JSAPI Demonstration program **");
  /* alan is a limited-domain voice that only knows how talk
         * about the time of day.
         */
  Voice alan = new Voice("alan",
    Voice.GENDER_DONT_CARE, Voice.AGE_DONT_CARE, null);

  /* kevin in an 8khz general domain diphone voice
         */
  Voice kevin = new Voice("kevin",
    Voice.GENDER_DONT_CARE, Voice.AGE_DONT_CARE, null);

        /* kevin16 in a 16khz general domain diphone voice
         */
  Voice kevinHQ = new Voice("kevin16",
    Voice.GENDER_DONT_CARE, Voice.AGE_DONT_CARE, null);

  try {
      /* Find a synthesizer that has the general domain voice
             * we are looking for.  NOTE:  this uses the Central class
View Full Code Here

     *
     * @param index the index of the voice
     */
    public void setVoice(int index) {
  try {
      Voice voice = (Voice) voiceList.getElementAt(index);
      if (voice != null) {
    float oldVolume = getVolume();
    float oldSpeakingRate = getSpeakingRate();
    synthesizer.waitEngineState(Synthesizer.QUEUE_EMPTY);
    synthesizer.getSynthesizerProperties().setVoice(voice);
View Full Code Here

            /* Choose the voice.
             */
            desc = (SynthesizerModeDesc) synthesizer.getEngineModeDesc();
            Voice[] voices = desc.getVoices();
            Voice voice = null;
            for (int i = 0; i < voices.length; i++) {
                if (voices[i].getName().equals(voiceName)) {
                    voice = voices[i];
                    break;
                }
View Full Code Here

        String id;
       
        // Is there a match by voice name?  If yes, return it.
        // Otherwise, ignore name.
        if (name != null && name.length() > 0) {
            id = getVoiceId(new Voice(name,
                                      Voice.GENDER_DONT_CARE,
                                      Voice.AGE_DONT_CARE,
                                      null),
                            0);
            if (id != null && id.length() > 0) {
                return id;
            }
        }
       

        // Try to match gender and age
        id = getVoiceId(new Voice(null,
                                  gender,
                                  age,
                                  null),
                        variant);
        if (id != null && id.length() > 0) {
            return id;
        }

        // Try to match gender and adjoining ages
        int looseAge = age | (age << 1) | (age >> 1);
        id = getVoiceId(new Voice(null,
                                  gender,
                                  looseAge,
                                  null),
                        variant);
        if (id != null && id.length() > 0) {
            return id;
        }

        // Try to match just gender
        id = getVoiceId(new Voice(null,
                                  gender,
                                  Voice.AGE_DONT_CARE,
                                  null),
                        variant);
        if (id != null && id.length() > 0) {
View Full Code Here

     *   the given value
     */
    public void setVoice(Voice voice)
        throws PropertyVetoException {
        // [[[TODO: Need to check that the voice is legal.]]]
        Voice oldVoice = currentVoice;
        currentVoice = (Voice)(voice.clone());
        postPropertyChangeEvent("Voice", oldVoice, voice);
    }
View Full Code Here

 
          Synthesizer synth = Central.createSynthesizer(desc);
          synth.allocate();
          desc = (SynthesizerModeDesc) synth.getEngineModeDesc();
          Voice[] voices = desc.getVoices();
          Voice voice = null;
          for (Voice entry : voices) {
              if(entry.getName().equals(voiceName)) {
                  voice = entry;
                  break;
              }
View Full Code Here

        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());
        }
    }
View Full Code Here

                System.exit(1);
            }
            synthesizer.allocate();
            synthesizer.resume();
            desc = (SynthesizerModeDesc) synthesizer.getEngineModeDesc();
            Voice voices[] = desc.getVoices();
            for (Voice v : voices) {
                synthesizer.getSynthesizerProperties().setVoice(v);
                synthesizer.speakPlainText("good job", null);
                synthesizer.waitEngineState(0x10000L);
            }
View Full Code Here

TOP

Related Classes of javax.speech.synthesis.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.