edu.cmu.sphinx.frontend.util
Class StreamCepstrumSource

java.lang.Object
  extended by edu.cmu.sphinx.util.props.ConfigurableAdapter
      extended by edu.cmu.sphinx.frontend.BaseDataProcessor
          extended by edu.cmu.sphinx.frontend.util.StreamCepstrumSource
All Implemented Interfaces:
DataProcessor, Configurable

public class StreamCepstrumSource
extends BaseDataProcessor

Produces Mel-cepstrum data from an InputStream. To set the inputstream with cepstral data, use the setInputStream method, and then call getData() to obtain the Data objects that have cepstra data in it.


Field Summary
private  boolean bigEndian
           
private  boolean binary
           
private  java.io.DataInputStream binaryStream
           
private  int cepstrumLength
           
private  int curPoint
           
private  ExtendedStreamTokenizer est
           
private  long firstSampleNumber
           
private  int frameShift
           
private  int frameSize
           
private  int numPoints
           
static java.lang.String PROP_BINARY
          The property specifying whether the input is in binary.
static java.lang.String PROP_CEPSTRUM_LENGTH
          The property specifying the length of the cepstrum data.
static java.lang.String PROP_FRAME_SHIFT_MS
          The property name for frame shift in milliseconds, which has a default value of 10F.
static java.lang.String PROP_FRAME_SIZE_MS
          The property name for frame size in milliseconds.
static java.lang.String PROP_SAMPLE_RATE
          The property that defines the sample rate
private  int sampleRate
           
 
Fields inherited from class edu.cmu.sphinx.util.props.ConfigurableAdapter
logger
 
Constructor Summary
StreamCepstrumSource()
           
StreamCepstrumSource(int cepstrumLength, boolean binary, float frameShiftMs, float frameSizeMs, int sampleRate)
           
 
Method Summary
 Data getData()
          Returns the next Data object, which is the mel cepstrum of the input frame.
 void initialize()
          Constructs a StreamCepstrumSource that reads MelCepstrum data from the given path.
 void newProperties(PropertySheet ps)
          This method is called when this configurable component needs to be reconfigured.
 void setInputStream(java.io.InputStream is, boolean bigEndian)
          Sets the InputStream to read cepstral data from.
 
Methods inherited from class edu.cmu.sphinx.frontend.BaseDataProcessor
getPredecessor, getTimer, setPredecessor
 
Methods inherited from class edu.cmu.sphinx.util.props.ConfigurableAdapter
getName, initLogger, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_BINARY

@S4Boolean(defaultValue=true)
public static final java.lang.String PROP_BINARY
The property specifying whether the input is in binary.

See Also:
Constant Field Values

PROP_FRAME_SIZE_MS

@S4Double(defaultValue=25.625)
public static final java.lang.String PROP_FRAME_SIZE_MS
The property name for frame size in milliseconds.

See Also:
Constant Field Values

PROP_FRAME_SHIFT_MS

@S4Double(defaultValue=10.0)
public static final java.lang.String PROP_FRAME_SHIFT_MS
The property name for frame shift in milliseconds, which has a default value of 10F.

See Also:
Constant Field Values

PROP_CEPSTRUM_LENGTH

@S4Integer(defaultValue=13)
public static final java.lang.String PROP_CEPSTRUM_LENGTH
The property specifying the length of the cepstrum data.

See Also:
Constant Field Values

PROP_SAMPLE_RATE

@S4Integer(defaultValue=16000)
public static final java.lang.String PROP_SAMPLE_RATE
The property that defines the sample rate

See Also:
Constant Field Values

binary

private boolean binary

est

private ExtendedStreamTokenizer est

binaryStream

private java.io.DataInputStream binaryStream

numPoints

private int numPoints

curPoint

private int curPoint

cepstrumLength

private int cepstrumLength

frameShift

private int frameShift

frameSize

private int frameSize

sampleRate

private int sampleRate

firstSampleNumber

private long firstSampleNumber

bigEndian

private boolean bigEndian
Constructor Detail

StreamCepstrumSource

public StreamCepstrumSource(int cepstrumLength,
                            boolean binary,
                            float frameShiftMs,
                            float frameSizeMs,
                            int sampleRate)

StreamCepstrumSource

public StreamCepstrumSource()
Method Detail

newProperties

public void newProperties(PropertySheet ps)
                   throws PropertyException
Description copied from interface: Configurable
This method is called when this configurable component needs to be reconfigured.

Specified by:
newProperties in interface Configurable
Overrides:
newProperties in class ConfigurableAdapter
Parameters:
ps - a property sheet holding the new data
Throws:
PropertyException - if there is a problem with the properties.

initialize

public void initialize()
Constructs a StreamCepstrumSource that reads MelCepstrum data from the given path.

Specified by:
initialize in interface DataProcessor
Overrides:
initialize in class BaseDataProcessor

setInputStream

public void setInputStream(java.io.InputStream is,
                           boolean bigEndian)
                    throws java.io.IOException
Sets the InputStream to read cepstral data from.

Parameters:
is - the InputStream to read cepstral data from
bigEndian - true if the InputStream data is in big-endian, false otherwise
Throws:
java.io.IOException - if an I/O error occurs

getData

public Data getData()
             throws DataProcessingException
Returns the next Data object, which is the mel cepstrum of the input frame. However, it can also be other Data objects like DataStartSignal.

Specified by:
getData in interface DataProcessor
Specified by:
getData in class BaseDataProcessor
Returns:
the next available Data object, returns null if no Data object is available
Throws:
DataProcessingException - if a data processing error occurs