1 package com.sun.speech.freetts.en.us;
3 import java.io.IOException;
5 import java.util.Locale;
7 import com.sun.speech.freetts.Age;
8 import com.sun.speech.freetts.Gender;
9 import com.sun.speech.freetts.Item;
10 import com.sun.speech.freetts.UtteranceProcessor;
11 import com.sun.speech.freetts.clunits.ClusterUnitSelector;
13 import de.dfki.lt.freetts.ClusterUnitNamer;
16 * Experimental class that selects units for the
17 * <a href="http://festvox.org/cmu_arctic/">CMU ARCTIC voices</a>.
19 public class CMUArcticVoice extends CMUClusterUnitVoice {
22 * Creates a simple cluster unit voice for the ARCTIC voices
24 * @param name the name of the voice
25 * @param gender the gender of the voice
26 * @param age the age of the voice
27 * @param description a human-readable string providing a
28 * description that can be displayed for the users.
29 * @param locale the locale of the voice
30 * @param domain the domain of this voice. For example,
31 * @param organization the organization which created the voice
32 * "general", "time", or
33 * "weather".
34 * @param lexicon the lexicon to load
35 * @param database the url to the database containing unit data
38 public CMUArcticVoice(String name, Gender gender, Age age,
39 String description, Locale locale, String domain,
40 String organization, CMULexicon lexicon, URL database) {
41 super(name, gender, age, description, locale,
42 domain, organization, lexicon, database);
46 * Returns the unit selector to be used by this voice.
47 * Derived voices typically override this to customize behaviors.
48 * This voice uses a cluster unit selector as the unit selector.
50 * @return the post lexical processor
52 * @throws IOException if an IO error occurs while getting
55 public UtteranceProcessor getUnitSelector() throws IOException {
56 ClusterUnitNamer unitNamer = new ClusterUnitNamer() {
57 public void setUnitName(Item seg) {
58 String VOWELS = "aeiou";
61 String segName = seg.getFeatures().getString("name");
64 * If we have a vowel, then the unit name is the segment name
65 * plus a 0 or 1, depending upon the stress of the parent.
66 * Otherwise, the unit name is the segment name plus "coda" or
67 * "onset" based upon the seg_onsetcoda feature processor.
69 if (segName.equals("pau")) {
71 } else if (VOWELS.indexOf(segName.charAt(0)) >= 0) {
72 cname = segName + seg.findFeature("R:SylStructure.parent.stress");
74 cname = segName + seg.findFeature("seg_onsetcoda");
77 seg.getFeatures().setString("clunit_name", cname);
81 return new ClusterUnitSelector(getDatabase(), unitNamer);