Package com.sun.speech.freetts.diphone
Class Diphone
java.lang.Object
com.sun.speech.freetts.diphone.Diphone
- Direct Known Subclasses:
AliasDiphone
Represents two adjacent phones. A diphone is defined by its name,
the set of audio data, and information used to help stitch diphones
together. This class is immutable.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
protected static final int
protected static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
dump()
dumps out this Diphone.void
Dumps the diphone to the given channel.void
dumpBinary
(ByteBuffer bb) Dumps the diphone to the given channel.int
Returns the midpoint index. the midpoint index is the sample that divides the diphone into the first and second parts.getName()
Gets the name of the diphone.int
Returns the midpoint index. the midpoint index is the sample that divides the diphone into the first and second parts.Sample[]
Returns the samples associated with this diphone.getSamples
(int which) Returns a particular sample.int
getUnitSize
(int unitPart) Returns the total number of residuals in the given part for this diphone.static Diphone
Loads a new diphone from the given DataInputStream.static Diphone
loadBinary
(ByteBuffer bb) Loads a new diphone from the given buffer.nearestSample
(float uIndex, int unitPart) Returns the sample that is closest to uIndex.
-
Field Details
-
MAGIC
protected static final int MAGIC- See Also:
-
ALIAS_MAGIC
protected static final int ALIAS_MAGIC- See Also:
-
NAME_LENGTH
protected static final int NAME_LENGTH- See Also:
-
-
Constructor Details
-
Diphone
Creates a diphone with the given name, samples and midpoint.- Parameters:
name
- the name of the diphonesamples
- the set of samples for the diphonemidPoint
- the index of the sample midpoint
-
Diphone
Constructor to be used only by subclasses who do not use the variables except for the name- Parameters:
name
- the name of the diphone
-
-
Method Details
-
getSamples
Returns the samples associated with this diphone.- Returns:
- the samples associated with this diphone
-
getSamples
Returns a particular sample.- Parameters:
which
- which sample to return- Returns:
- the desired sample
-
getName
Gets the name of the diphone.- Returns:
- the name of the diphone
-
getMidPoint
public int getMidPoint()Returns the midpoint index. the midpoint index is the sample that divides the diphone into the first and second parts.- Returns:
- the midpoint index.
-
getPbPositionMillis
public int getPbPositionMillis()Returns the midpoint index. the midpoint index is the sample that divides the diphone into the first and second parts.- Returns:
- the midpoint index.
-
nearestSample
Returns the sample that is closest to uIndex.- Parameters:
uIndex
- the desired indexunitPart
- do we want the first have (1) or the second half (2)- Returns:
- the sample nearest to the given index in the given part
-
getUnitSize
public int getUnitSize(int unitPart) Returns the total number of residuals in the given part for this diphone.- Parameters:
unitPart
- indicates which part is of interest (1 or 2)- Returns:
- the number of residuals in the specified part
-
dump
public void dump()dumps out this Diphone. -
dumpBinary
Dumps the diphone to the given channel.- Parameters:
bb
- the ByteBuffer to write to- Throws:
IOException
- if IO error occurs
-
dumpBinary
Dumps the diphone to the given channel.- Parameters:
os
- the DataOutputStream to write to- Throws:
IOException
- if IO error occurs
-
loadBinary
Loads a new diphone from the given buffer.- Parameters:
bb
- the byte buffer to load the diphone from- Returns:
- the new diphone
- Throws:
IOException
- if IO error occurs
-
loadBinary
Loads a new diphone from the given DataInputStream.- Parameters:
dis
- the datainput stream to load the diphone from- Returns:
- the new diphone
- Throws:
IOException
- if IO error occurs
-