1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
\r
5 <!-- Generated by javadoc (build 1.4.2_16) on Mon Mar 09 18:20:30 CET 2009 -->
\r
7 DiphoneUnitDatabase (FreeTTS 1.2)
\r
10 <META NAME="keywords" CONTENT="com.sun.speech.freetts.diphone.DiphoneUnitDatabase class">
\r
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
\r
14 <SCRIPT type="text/javascript">
\r
15 function windowTitle()
\r
17 parent.document.title="DiphoneUnitDatabase (FreeTTS 1.2)";
\r
23 <BODY BGCOLOR="white" onload="windowTitle();">
\r
26 <!-- ========= START OF TOP NAVBAR ======= -->
\r
27 <A NAME="navbar_top"><!-- --></A>
28 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
29 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
\r
31 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
\r
32 <A NAME="navbar_top_firstrow"><!-- --></A>
33 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
\r
34 <TR ALIGN="center" VALIGN="top">
\r
35 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
\r
36 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
\r
37 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
\r
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
\r
39 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
\r
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
\r
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
\r
45 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
\r
51 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
52 <A HREF="../../../../../com/sun/speech/freetts/diphone/DiphonePitchmarkGenerator.html" title="class in com.sun.speech.freetts.diphone"><B>PREV CLASS</B></A>
\r
53 <A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitSelector.html" title="class in com.sun.speech.freetts.diphone"><B>NEXT CLASS</B></A></FONT></TD>
\r
54 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
55 <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
\r
56 <A HREF="DiphoneUnitDatabase.html" target="_top"><B>NO FRAMES</B></A>
\r
57 <SCRIPT type="text/javascript">
\r
60 document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
\r
65 <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
\r
71 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
72 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
\r
73 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
74 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
\r
77 <A NAME="skip-navbar_top"></A>
78 <!-- ========= END OF TOP NAVBAR ========= -->
\r
81 <!-- ======== START OF CLASS DATA ======== -->
\r
84 com.sun.speech.freetts.diphone</FONT>
\r
86 Class DiphoneUnitDatabase</H2>
\r
89 <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by"><B>com.sun.speech.freetts.diphone.DiphoneUnitDatabase</B>
\r
93 <DT>public class <B>DiphoneUnitDatabase</B><DT>extends java.lang.Object</DL>
\r
96 Represents and manages the unit data for all diphones. The diphone
97 data set is stored in a set of data files. These data are loaded by this
98 class into internal data structures before diphone synthesis can
101 The diphone data set is one of the largest sets of data that
102 needs to be loaded by the synthesizer and therefore can add to the
103 overall startup time for any system using this database. For
104 certain applications, the startup time is a critical spec that
105 needs to be optimized, while for other applications, startup time
106 is inconsequential. This class provides settings (via system
107 properties) that control how the database is to be loaded so that
108 applications can tune for quick startup or optimal run time.
110 This class serves also as a testbed for comparing performance of
111 the traditional java binary I/O and the new io ( <code>java.nio </code>)
114 <p> A diphone database can be loaded from a text data file, or a
115 binary datafile. The binary version loads significantly faster
116 than the text version. Additionally, a binary index can be
117 generated and used to reduce overall memory footprint.
120 A DiphoneUnitDatabase contains an array of frames, and an aray of
121 residuals. The frames are the samples of the wave, and the
122 residuals are for linear predictive coding use. This is called
123 "cst_sts" (a struct) in flite.
125 Note that if 'com.sun.speech.freetts.useNewIO' is set to true and
126 the input type is binary, than the JDK1.4+ new IO api is used to
131 com.sun.speech.freetts.diphone.UnitDatabase.cacheType
134 can be set to one of:
137 <li> preload: database is loaded at startup
138 <li> demand: database is loaded on demand
139 <li> hard: database is loaded on demand but cached
140 <li> soft: database is loaded on demand but cached with soft references
143 This <code> cacheType </code> setting controls how the database is
144 loaded. The default is to 'preload' the database. This setting
145 gives best runtime performance but with longer initial startup
153 <!-- ======== NESTED CLASS SUMMARY ======== -->
\r
156 <!-- =========== FIELD SUMMARY =========== -->
\r
159 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
\r
161 <A NAME="constructor_summary"><!-- --></A>
162 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
163 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
164 <TD COLSPAN=2><FONT SIZE="+2">
\r
165 <B>Constructor Summary</B></FONT></TD>
\r
167 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
168 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitDatabase.html#DiphoneUnitDatabase(java.net.URL, boolean)">DiphoneUnitDatabase</A></B>(java.net.URL url,
169 boolean isBinary)</CODE>
\r
172 Creates the DiphoneUnitDatabase from the given input stream.</TD>
\r
176 <!-- ========== METHOD SUMMARY =========== -->
\r
178 <A NAME="method_summary"><!-- --></A>
179 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
180 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
181 <TD COLSPAN=2><FONT SIZE="+2">
\r
182 <B>Method Summary</B></FONT></TD>
\r
184 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
185 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
186 <CODE> boolean</CODE></FONT></TD>
\r
187 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitDatabase.html#compare(com.sun.speech.freetts.diphone.DiphoneUnitDatabase)">compare</A></B>(<A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitDatabase.html" title="class in com.sun.speech.freetts.diphone">DiphoneUnitDatabase</A> other)</CODE>
\r
190 Compares this database to another. </TD>
\r
192 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
193 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
194 <CODE> void</CODE></FONT></TD>
\r
195 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitDatabase.html#dump()">dump</A></B>()</CODE>
\r
198 Dumps the diphone database.</TD>
\r
200 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
201 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
202 <CODE> void</CODE></FONT></TD>
\r
203 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitDatabase.html#dumpBinary(java.lang.String)">dumpBinary</A></B>(java.lang.String path)</CODE>
\r
206 Dumps a binary form of the database.</TD>
\r
208 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
209 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
210 <CODE> java.lang.String</CODE></FONT></TD>
\r
211 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitDatabase.html#getName()">getName</A></B>()</CODE>
\r
214 Returns the name of this DiphoneUnitDatabase.</TD>
\r
216 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
217 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
218 <CODE> <A HREF="../../../../../com/sun/speech/freetts/diphone/Diphone.html" title="class in com.sun.speech.freetts.diphone">Diphone</A></CODE></FONT></TD>
\r
219 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitDatabase.html#getUnit(java.lang.String)">getUnit</A></B>(java.lang.String unitName)</CODE>
\r
222 Looks up the diphone with the given name.</TD>
\r
224 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
225 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
226 <CODE>static void</CODE></FONT></TD>
\r
227 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitDatabase.html#main(java.lang.String[])">main</A></B>(java.lang.String[] args)</CODE>
\r
230 Manipulates a DiphoneUnitDatabase. </TD>
\r
233 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
234 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
235 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
\r
236 <TD><B>Methods inherited from class java.lang.Object</B></TD>
\r
238 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
239 <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
\r
245 <!-- ============ FIELD DETAIL =========== -->
\r
248 <!-- ========= CONSTRUCTOR DETAIL ======== -->
\r
250 <A NAME="constructor_detail"><!-- --></A>
251 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
252 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
253 <TD COLSPAN=1><FONT SIZE="+2">
\r
254 <B>Constructor Detail</B></FONT></TD>
\r
258 <A NAME="DiphoneUnitDatabase(java.net.URL, boolean)"><!-- --></A><H3>
\r
259 DiphoneUnitDatabase</H3>
\r
261 public <B>DiphoneUnitDatabase</B>(java.net.URL url,
262 boolean isBinary)
263 throws java.io.IOException</PRE>
\r
265 <DD>Creates the DiphoneUnitDatabase from the given input stream.
\r
267 <DT><B>Parameters:</B><DD><CODE>url</CODE> - the location of the database<DD><CODE>isBinary</CODE> - if <code>true</code> the database is in
268 binary format; otherwise it is in text format
270 <DD><CODE>java.io.IOException</CODE> - if there is trouble opening the DB</DL>
\r
272 <!-- ============ METHOD DETAIL ========== -->
\r
274 <A NAME="method_detail"><!-- --></A>
275 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
276 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
277 <TD COLSPAN=1><FONT SIZE="+2">
\r
278 <B>Method Detail</B></FONT></TD>
\r
282 <A NAME="getUnit(java.lang.String)"><!-- --></A><H3>
\r
285 public <A HREF="../../../../../com/sun/speech/freetts/diphone/Diphone.html" title="class in com.sun.speech.freetts.diphone">Diphone</A> <B>getUnit</B>(java.lang.String unitName)</PRE>
\r
287 <DD>Looks up the diphone with the given name.
\r
290 <DT><B>Parameters:</B><DD><CODE>unitName</CODE> - the name of the diphone to look for
291 <DT><B>Returns:</B><DD>the diphone or the defaultDiphone if not found.</DL>
\r
296 <A NAME="getName()"><!-- --></A><H3>
\r
299 public java.lang.String <B>getName</B>()</PRE>
\r
301 <DD>Returns the name of this DiphoneUnitDatabase.
\r
309 <A NAME="dump()"><!-- --></A><H3>
\r
312 public void <B>dump</B>()</PRE>
\r
314 <DD>Dumps the diphone database.
\r
322 <A NAME="dumpBinary(java.lang.String)"><!-- --></A><H3>
\r
325 public void <B>dumpBinary</B>(java.lang.String path)</PRE>
\r
327 <DD>Dumps a binary form of the database.
\r
330 <DT><B>Parameters:</B><DD><CODE>path</CODE> - the path to dump the file to</DL>
\r
335 <A NAME="compare(com.sun.speech.freetts.diphone.DiphoneUnitDatabase)"><!-- --></A><H3>
\r
338 public boolean <B>compare</B>(<A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitDatabase.html" title="class in com.sun.speech.freetts.diphone">DiphoneUnitDatabase</A> other)</PRE>
\r
340 <DD>Compares this database to another. This is used for testing.
341 With this method we can load up two databases (one perhaps from
342 a text source and one from a binary source) and compare to
343 verify that the dbs are identical
\r
346 <DT><B>Parameters:</B><DD><CODE>other</CODE> - the other database
347 <DT><B>Returns:</B><DD><code>true</code> if the DBs are identical;
348 otherwise <code>false</code></DL>
\r
353 <A NAME="main(java.lang.String[])"><!-- --></A><H3>
\r
356 public static void <B>main</B>(java.lang.String[] args)</PRE>
\r
358 <DD>Manipulates a DiphoneUnitDatabase. This program is typically
359 used to generate the binary form (with index) of the
360 DiphoneUnitDatabase from the text form. Additionally, this program
361 can be used to compare two databases to see if they are
362 identical (used for testing).
367 <code> java com.sun.speech.freetts.diphone.DiphoneUnitDatabase
373 <li> <code> -src path </code> provides a directory
374 path to the source text for the database
375 <li> <code> -dest path </code> provides a directory
376 for where to place the resulting binaries
377 <li> <code> -generate_binary [filename] </code>
379 version of the database and generates the binary
380 version of the database.
381 <li> <code> -compare </code> Loads the text and
382 binary versions of the database and compares them to
383 see if they are equivalent.
384 <li> <code> -showTimes </code> shows timings for any
385 loading, comparing or dumping operation
392 <!-- ========= END OF CLASS DATA ========= -->
\r
396 <!-- ======= START OF BOTTOM NAVBAR ====== -->
\r
397 <A NAME="navbar_bottom"><!-- --></A>
398 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
399 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
\r
401 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
\r
402 <A NAME="navbar_bottom_firstrow"><!-- --></A>
403 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
\r
404 <TR ALIGN="center" VALIGN="top">
\r
405 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
\r
406 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
\r
407 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
\r
408 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
\r
409 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
\r
410 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
\r
411 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
\r
415 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
\r
421 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
422 <A HREF="../../../../../com/sun/speech/freetts/diphone/DiphonePitchmarkGenerator.html" title="class in com.sun.speech.freetts.diphone"><B>PREV CLASS</B></A>
\r
423 <A HREF="../../../../../com/sun/speech/freetts/diphone/DiphoneUnitSelector.html" title="class in com.sun.speech.freetts.diphone"><B>NEXT CLASS</B></A></FONT></TD>
\r
424 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
425 <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
\r
426 <A HREF="DiphoneUnitDatabase.html" target="_top"><B>NO FRAMES</B></A>
\r
427 <SCRIPT type="text/javascript">
\r
430 document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
\r
435 <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
\r
441 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
442 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
\r
443 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
444 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
\r
447 <A NAME="skip-navbar_bottom"></A>
448 <!-- ======== END OF BOTTOM NAVBAR ======= -->
\r