|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.speech.freetts.diphone.DiphoneUnitDatabase
Represents and manages the unit data for all diphones. The diphone data set is stored in a set of data files. These data are loaded by this class into internal data structures before diphone synthesis can occur.
The diphone data set is one of the largest sets of data that needs to be loaded by the synthesizer and therefore can add to the overall startup time for any system using this database. For certain applications, the startup time is a critical spec that needs to be optimized, while for other applications, startup time is inconsequential. This class provides settings (via system properties) that control how the database is to be loaded so that applications can tune for quick startup or optimal run time.
This class serves also as a testbed for comparing performance of
the traditional java binary I/O and the new io ( java.nio
)
package.
A diphone database can be loaded from a text data file, or a binary datafile. The binary version loads significantly faster than the text version. Additionally, a binary index can be generated and used to reduce overall memory footprint.
A DiphoneUnitDatabase contains an array of frames, and an aray of residuals. The frames are the samples of the wave, and the residuals are for linear predictive coding use. This is called "cst_sts" (a struct) in flite.
Note that if 'com.sun.speech.freetts.useNewIO' is set to true and the input type is binary, than the JDK1.4+ new IO api is used to load the database.
The system property
com.sun.speech.freetts.diphone.UnitDatabase.cacheTypecan be set to one of:
cacheType
setting controls how the database is
loaded. The default is to 'preload' the database. This setting
gives best runtime performance but with longer initial startup
cost.
Constructor Summary | |
DiphoneUnitDatabase(java.net.URL url,
boolean isBinary)
Creates the DiphoneUnitDatabase from the given input stream. |
Method Summary | |
boolean |
compare(DiphoneUnitDatabase other)
Compares this database to another. |
void |
dump()
Dumps the diphone database. |
void |
dumpBinary(java.lang.String path)
Dumps a binary form of the database. |
java.lang.String |
getName()
Returns the name of this DiphoneUnitDatabase. |
Diphone |
getUnit(java.lang.String unitName)
Looks up the diphone with the given name. |
static void |
main(java.lang.String[] args)
Manipulates a DiphoneUnitDatabase. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DiphoneUnitDatabase(java.net.URL url, boolean isBinary) throws java.io.IOException
url
- the location of the databaseisBinary
- if true
the database is in
binary format; otherwise it is in text format
java.io.IOException
- if there is trouble opening the DBMethod Detail |
public Diphone getUnit(java.lang.String unitName)
unitName
- the name of the diphone to look for
public java.lang.String getName()
public void dump()
public void dumpBinary(java.lang.String path)
path
- the path to dump the file topublic boolean compare(DiphoneUnitDatabase other)
other
- the other database
true
if the DBs are identical;
otherwise false
public static void main(java.lang.String[] args)
Usage
java com.sun.speech.freetts.diphone.DiphoneUnitDatabase
[options]
Options
-src path
provides a directory
path to the source text for the database
-dest path
provides a directory
for where to place the resulting binaries
-generate_binary [filename]
reads in the text
version of the database and generates the binary
version of the database.
-compare
Loads the text and
binary versions of the database and compares them to
see if they are equivalent.
-showTimes
shows timings for any
loading, comparing or dumping operation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |