Package com.sun.speech.freetts

Examples of com.sun.speech.freetts.Voice$FreeTTSSpeakableTokenizer


 
  public Voice getVoice() {
    System.setProperty("freetts.voices","com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");
    if(this.voice == null) {
          VoiceManager voiceManager = VoiceManager.getInstance();
      Voice helloVoice = voiceManager.getVoice("kevin16");
      if (helloVoice == null) {
        System.err.println("Cannot find voices");
        for(Voice voice : voiceManager.getVoices()) {
          System.out.println("Voice: " + voice.getName());
        }
      }
      helloVoice.allocate();
      this.voice = helloVoice;
    }
    return this.voice;
  }
View Full Code Here


            return new Voice[0];
        } else {

            CMULexicon lexicon = new CMULexicon("cmulex");
           
            Voice mbrola1 = new MbrolaVoice
                ("us1", "us1", 150f, 180F, 22F,
                 "mbrola_us1", Gender.FEMALE, Age.YOUNGER_ADULT,
                 "MBROLA Voice us1",
                 Locale.US, "general", "mbrola", lexicon);

            Voice mbrola2 = new MbrolaVoice
                ("us2", "us2", 150f, 115F, 12F,
                 "mbrola_us2", Gender.MALE, Age.YOUNGER_ADULT,
                 "MBROLA Voice us2",
                 Locale.US, "general", "mbrola", lexicon);

            Voice mbrola3 = new MbrolaVoice
                ("us3", "us3", 150f, 125F, 12F,
                 "mbrola_us3", Gender.MALE, Age.YOUNGER_ADULT,
                 "MBROLA Voice us3",
                 Locale.US, "general", "mbrola", lexicon);
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.");

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

     * Fixes apostrophe s segments.
     *
     * @param utterance the utterance to fix
     */
    private void fixApostrophe(Utterance utterance) {
  Voice voice = utterance.getVoice();
  for (Item item = utterance.getRelation(Relation.SEGMENT).getHead();
    item != null;
    item = item.getNext()) {
      String word = wordPath.findFeature(item).toString();

      if (word.equals("'s")) {

    String pname = item.getPrevious().toString();

    if (("fa".indexOf(
          voice.getPhoneFeature(pname,"ctype")) != -1) &&
        ("dbg".indexOf(
          voice.getPhoneFeature(pname, "cplace")) == -1)) {
        prependSchwa(item);
    } else  if (voice.getPhoneFeature(pname, "cvox").equals("-")) {
        item.getFeatures().setString("name", "s");
    }
      } else if (word.equals("'ve") ||
           word.equals("'ll") || word.equals("'d")) {
    if ("-".equals(P_PH_VC.findFeature(item))) {
View Full Code Here

     * example.
     *
     * @param  utterance  the utterance to process
     */
    private void fixTheIy(Utterance utterance) {
  Voice voice = utterance.getVoice();
  for (Item item = utterance.getRelation(Relation.SEGMENT).getHead();
    item != null; item = item.getNext()) {

      if ("ax".equals(item.toString())) {
    String word = wordPath.findFeature(item).toString();
View Full Code Here

     * @param syllable the syllable of interest
     *
     * @return the time point mid way in vowel in this syllable
     */
    private final float vowelMid(Item syllable) {
  Voice voice = syllable.getUtterance().getVoice();
  Item firstSeg  = syllable.getItemAs(
            Relation.SYLLABLE_STRUCTURE).getDaughter();
  Item segment;
  float val;

  for (segment = firstSeg; segment != null; segment =segment.getNext()) {
      // TODO refactor phone feature stuff like this so that
      // it can be understood.
      if ("+".equals(voice.getPhoneFeature(segment.toString(), "vc"))) {
    val = (segment.getFeatures().getFloat("end") +
         ((Float) vowelMidPath.findFeature(segment)).floatValue()) / 2.0f;
    return val;
      }
  }
View Full Code Here

        // default to LDOM naming scheme 'ae_afternoon':
  String cname = null;

  String segName = seg.getFeatures().getString("name");

    Voice voice = seg.getUtterance().getVoice();
    String silenceSymbol = voice.getPhoneFeature("silence", "symbol");
    if (silenceSymbol == null)
        silenceSymbol = "pau";
  if (segName.equals(silenceSymbol)) {
      cname = silenceSymbol + "_" + seg.findFeature("p.name");
  } else {
View Full Code Here

     *
     * @return an array of new Voice instances
     */
    public Voice[] getVoices() {
        CMULexicon lexicon = new CMULexicon("cmutimelex");
        Voice alan = new CMUClusterUnitVoice("alan", Gender.MALE,
                Age.YOUNGER_ADULT, "default time-domain cluster unit voice",
                Locale.US, "time", "cmu", lexicon,
                this.getClass().getResource("cmu_time_awb.bin"));
        Voice[] voices = {alan};
        return voices;
View Full Code Here

     *
     * @return an array of new Voice instances
     */
    public Voice[] getVoices() {
        CMULexicon lexicon = new CMULexicon("cmulex");
        Voice kevin = new CMUDiphoneVoice("kevin", Gender.MALE,
                Age.YOUNGER_ADULT, "default 8-bit diphone voice",
                Locale.US, "general", "cmu", lexicon,
                this.getClass().getResource("cmu_us_kal.bin"));
        Voice kevin16 = new CMUDiphoneVoice("kevin16", Gender.MALE,
                Age.YOUNGER_ADULT, "default 16-bit diphone voice",
                Locale.US, "general", "cmu", lexicon,
                this.getClass().getResource("cmu_us_kal16.bin"));

        Voice[] voices = {kevin, kevin16};
View Full Code Here

     * @return the phone feature for the item
     *
     */

    public static String getPhoneFeature(Item item, String featureName) {
  Voice voice = item.getUtterance().getVoice();
  String feature = voice.getPhoneFeature(item.toString(), featureName);
  return feature;
    }
View Full Code Here

TOP

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

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.