public class Diphone extends Object
Modifier and Type | Field and Description |
---|---|
protected static int |
ALIAS_MAGIC |
protected static int |
MAGIC |
private int |
midPoint |
private String |
name |
protected static int |
NAME_LENGTH |
private Sample[] |
samples |
private int |
unitSizePart1 |
private int |
unitSizePart2 |
Modifier | Constructor and Description |
---|---|
protected |
Diphone(String name)
Constructor to be used only by subclasses who do not use the
variables except for the name
|
|
Diphone(String name,
Sample[] samples,
int midPoint)
Creates a diphone with the given name, samples and midpoint.
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
compare(Diphone other)
Determines if the two diphones are equivalent.
|
void |
dump()
dumps out this Diphone.
|
void |
dumpBinary(ByteBuffer bb)
Dumps the diphone to the given channel.
|
void |
dumpBinary(DataOutputStream os)
Dumps the diphone to the given channel.
|
int |
getMidPoint()
Returns the midpoint index. the midpoint index is the sample
that divides the diphone into the first and second parts.
|
String |
getName()
Gets the name of the diphone.
|
int |
getPbPositionMillis()
Returns the midpoint index. the midpoint index is the sample
that divides the diphone into the first and second parts.
|
Sample[] |
getSamples()
Returns the samples associated with this diphone.
|
Sample |
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 |
loadBinary(ByteBuffer bb)
Loads a new diphone from the given buffer.
|
static Diphone |
loadBinary(DataInputStream dis)
Loads a new diphone from the given DataInputStream.
|
Sample |
nearestSample(float uIndex,
int unitPart)
Returns the sample that is closest to uIndex.
|
protected static final int MAGIC
protected static final int ALIAS_MAGIC
protected static final int NAME_LENGTH
private int midPoint
private int unitSizePart1
private int unitSizePart2
public Diphone(String name, Sample[] samples, int midPoint)
name
- the name of the diphonesamples
- the set of samples for the diphonemidPoint
- the index of the sample midpointpublic Sample[] getSamples()
public Sample getSamples(int which)
which
- which sample to returnpublic int getMidPoint()
public int getPbPositionMillis()
public Sample nearestSample(float uIndex, int unitPart)
uIndex
- the desired indexunitPart
- do we want the first have (1) or the second
half (2)public int getUnitSize(int unitPart)
unitPart
- indicates which part is of interest (1 or 2)public void dump()
public void dumpBinary(ByteBuffer bb) throws IOException
bb
- the ByteBuffer to write toIOException
- if IO error occurspublic void dumpBinary(DataOutputStream os) throws IOException
os
- the DataOutputStream to write toIOException
- if IO error occursboolean compare(Diphone other)
other
- the diphone to compare this one totrue
if the diphones match; otherwise
false
public static Diphone loadBinary(ByteBuffer bb) throws IOException
bb
- the byte buffer to load the diphone fromIOException
- if IO error occurspublic static Diphone loadBinary(DataInputStream dis) throws IOException
dis
- the datainput stream to load the diphone fromIOException
- if IO error occursWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses