|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cmu.sphinx.util.props.ConfigurableAdapter
edu.cmu.sphinx.frontend.BaseDataProcessor
edu.cmu.sphinx.frontend.util.AudioFileDataSource
public class AudioFileDataSource
An AudioFileDataSource generates a stream of audio data from a given audio file. All required information concerning
the audio format are read directly from the file . One would need to call setAudioFile(java.io.File,String)
to set the input file, and call getData() to obtain the Data frames.
| Field Summary | |
|---|---|
static java.lang.String |
AUDIO_FILE_LISTENERS
|
static java.lang.String |
PROP_BYTES_PER_READ
SphinxProperty for the number of bytes to read from the InputStream each time. |
| Constructor Summary | |
|---|---|
AudioFileDataSource()
|
|
AudioFileDataSource(int bytesPerRead,
java.util.List<AudioFileProcessListener> listeners)
|
|
| Method Summary | |
|---|---|
void |
addNewFileListener(AudioFileProcessListener l)
Adds a new listener for new file events. |
Data |
getData()
Reads and returns the next Data from the InputStream of StreamDataSource, return null if no data is read and end of file is reached. |
int |
getSampleRate()
|
void |
initialize()
Initializes this DataProcessor. |
boolean |
isBigEndian()
|
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured. |
void |
removeNewFileListener(AudioFileProcessListener l)
Removes a listener for new file events. |
void |
setAudioFile(java.io.File audioFile,
java.lang.String streamName)
Sets the audio file from which the data-stream will be generated of. |
void |
setAudioFile(java.net.URL audioFileURL,
java.lang.String streamName)
Sets the audio file from which the data-stream will be generated of. |
void |
setInputStream(javax.sound.sampled.AudioInputStream inputStream,
java.lang.String streamName)
Sets the InputStream from which this StreamDataSource reads. |
| Methods inherited from class edu.cmu.sphinx.frontend.BaseDataProcessor |
|---|
getPredecessor, getTimer, setPredecessor |
| Methods inherited from class edu.cmu.sphinx.util.props.ConfigurableAdapter |
|---|
getName, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
@S4Integer(defaultValue=3200) public static final java.lang.String PROP_BYTES_PER_READ
@S4ComponentList(type=Configurable.class) public static final java.lang.String AUDIO_FILE_LISTENERS
| Constructor Detail |
|---|
public AudioFileDataSource(int bytesPerRead,
java.util.List<AudioFileProcessListener> listeners)
public AudioFileDataSource()
| Method Detail |
|---|
public void newProperties(PropertySheet ps)
throws PropertyException
Configurable
newProperties in interface ConfigurablenewProperties in class ConfigurableAdapterps - a property sheet holding the new data
PropertyException - if there is a problem with the properties.public void initialize()
BaseDataProcessor
initialize in interface DataProcessorinitialize in class BaseDataProcessor
public void setAudioFile(java.io.File audioFile,
java.lang.String streamName)
audioFile - The location of the audio file to usestreamName - The name of the InputStream. if null the complete path of the audio file will be
uses as stream name.
public void setAudioFile(java.net.URL audioFileURL,
java.lang.String streamName)
audioFileURL - The location of the audio file to usestreamName - The name of the InputStream. if null the complete path of the audio file will be
uses as stream name.
public void setInputStream(javax.sound.sampled.AudioInputStream inputStream,
java.lang.String streamName)
inputStream - the InputStream from which audio data comesstreamName - the name of the InputStream
public Data getData()
throws DataProcessingException
getData in interface DataProcessorgetData in class BaseDataProcessornull if none is available
DataProcessingException - if there is a data processing errorpublic int getSampleRate()
public boolean isBigEndian()
public void addNewFileListener(AudioFileProcessListener l)
l - public void removeNewFileListener(AudioFileProcessListener l)
l -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||