2 * Portions Copyright 2001 Sun Microsystems, Inc.
3 * Portions Copyright 1999-2001 Language Technologies Institute,
4 * Carnegie Mellon University.
5 * All Rights Reserved. Use is subject to license terms.
7 * See the file "license.terms" for information on usage and
8 * redistribution of this file, and for a DISCLAIMER OF ALL
11 package com.sun.speech.freetts.en.us;
13 import java.io.IOException;
15 import java.util.Locale;
17 import com.sun.speech.freetts.Age;
18 import com.sun.speech.freetts.Gender;
19 import com.sun.speech.freetts.UtteranceProcessor;
20 import com.sun.speech.freetts.clunits.ClusterUnitPitchmarkGenerator;
21 import com.sun.speech.freetts.clunits.ClusterUnitSelector;
22 import com.sun.speech.freetts.relp.UnitConcatenator;
24 import de.dfki.lt.freetts.ConcatenativeVoice;
27 * Defines voice that does cluster unit selection.
29 public class CMUClusterUnitVoice extends CMUVoice implements ConcatenativeVoice {
31 protected URL database;
34 * Creates a simple cluster unit voice
36 * @param name the name of the voice
37 * @param gender the gender of the voice
38 * @param age the age of the voice
39 * @param description a human-readable string providing a
40 * description that can be displayed for the users.
41 * @param locale the locale of the voice
42 * @param domain the domain of this voice. For example,
43 * @param organization the organization which created the voice
44 * "general", "time", or
45 * "weather".
46 * @param lexicon the lexicon to load
47 * @param database the url to the database containing unit data
50 public CMUClusterUnitVoice(String name, Gender gender, Age age,
51 String description, Locale locale, String domain,
52 String organization, CMULexicon lexicon, URL database) {
53 super(name, gender, age, description, locale,
54 domain, organization, lexicon);
58 this.database = database;
62 * Gets the url to the database that defines the unit data for this
65 * @return a url to the database
67 public URL getDatabase() {
72 * Sets up the FeatureSet for this Voice.
74 * @throws IOException if an I/O error occurs
76 protected void setupFeatureSet() throws IOException {
77 super.setupFeatureSet();
78 getFeatures().setString(FEATURE_JOIN_TYPE, "simple_join");
82 * Returns the unit selector to be used by this voice.
83 * Derived voices typically override this to customize behaviors.
84 * This voice uses a cluster unit selector as the unit selector.
86 * @return the post lexical processor
88 * @throws IOException if an IO error occurs while getting
91 public UtteranceProcessor getUnitSelector() throws IOException {
92 return new ClusterUnitSelector(getDatabase());
96 * Returns the pitch mark generator to be used by this voice.
97 * Derived voices typically override this to customize behaviors.
98 * There is no default unit selector
100 * @return the post lexical processor
102 * @throws IOException if an IO error occurs while getting
105 public UtteranceProcessor getPitchmarkGenerator() throws IOException {
106 return new ClusterUnitPitchmarkGenerator();
110 * Returns the unit concatenator to be used by this voice.
111 * Derived voices typically override this to customize behaviors.
112 * There is no default unit selector
114 * @return the post lexical processor
116 * @throws IOException if an IO error occurs while getting
119 public UtteranceProcessor getUnitConcatenator() throws IOException {
120 return new UnitConcatenator();
125 * Converts this object to a string
127 * @return a string representation of this object
129 public String toString() {
130 return "CMUClusterUnitVoice";