Package com.sun.speech.freetts.relp
Class Sample
java.lang.Object
com.sun.speech.freetts.relp.Sample
A single short term sample containing Residual Excited Linear Predictive
(RELP) frame and residual voice data.
-
Constructor Summary
ConstructorsConstructorDescriptionSample
(short[] frameData, byte[] residualData) Constructs a RELP Sample from its component partsSample
(short[] frameData, byte[] residualData, int residualSize) Constructs a Sample from its component partsSample
(BufferedReader reader, int numChannels) Reads a sample from the input reader. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares two samples.void
dump()
Dumps the sample:void
Dumps the samples to the given streamvoid
dumpBinary
(ByteBuffer bb) Dumps the samples to the given ByteBuffershort[]
Gets the frame data associated with this sampleint
getFrameData
(int which) Returns the normalized frame data.byte[]
Gets the residual data associated with this sampleint
getResidualData
(int which) Returns the normalized residual data.int
Returns the number of residuals in this Sample.static Sample
Loads the samples from the given channelstatic Sample
loadBinary
(ByteBuffer bb) Loads the samples from the byte bufer
-
Constructor Details
-
Sample
public Sample(short[] frameData, byte[] residualData) Constructs a RELP Sample from its component parts- Parameters:
frameData
- the framedataresidualData
- the residual data
-
Sample
public Sample(short[] frameData, byte[] residualData, int residualSize) Constructs a Sample from its component parts- Parameters:
frameData
- the framedataresidualData
- the residual data
-
Sample
Reads a sample from the input reader.- Parameters:
reader
- the input reader to read the data fromnumChannels
- the number of channels per frame
-
-
Method Details
-
getFrameData
public short[] getFrameData()Gets the frame data associated with this sample- Returns:
- the frame data associated with this sample
-
getResidualData
public byte[] getResidualData()Gets the residual data associated with this sample- Returns:
- the residual data associated with this sample
-
getResidualSize
public int getResidualSize()Returns the number of residuals in this Sample.- Returns:
- the number of residuals in this sample
-
getResidualData
public int getResidualData(int which) Returns the normalized residual data. You may not want to call this function because of the overhead involved.- Parameters:
which
- the index of the data of interest- Returns:
- the normalized data.
-
getFrameData
public int getFrameData(int which) Returns the normalized frame data. You may not want to call this function because of the overhead involved.- Parameters:
which
- the index of the data of interest- Returns:
- the normalized data.
-
dump
public void dump()Dumps the sample: -
dumpBinary
Dumps the samples to the given ByteBuffer- Parameters:
bb
- the ByteBuffer to write the data to.- Throws:
IOException
- if IO error occurs
-
dumpBinary
Dumps the samples to the given stream- Parameters:
os
- the DataOutputStream to write the data to.- Throws:
IOException
- if IO error occurs
-
loadBinary
Loads the samples from the byte bufer- Parameters:
bb
- the byte buffer to read the data from.- Throws:
IOException
- if IO error occurs
-
loadBinary
Loads the samples from the given channel- Parameters:
dis
- the DataInputStream to read the data from.- Throws:
IOException
- if IO error occurs
-
compare
Compares two samples. Note that this is not the same as "equals"- Parameters:
other
- the other sample to compare this one to- Returns:
true
if they compare; otherwisefalse
-