|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sphinx.frontend.BaseDataProcessor
edu.cmu.sphinx.frontend.util.AudioFileDataSource
public class AudioFileDataSource
An AudioFileDataSource generates a stream of audio data from a given audion 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. |
static int |
PROP_BYTES_PER_READ_DEFAULT
Default value for PROP_BYTES_PER_READ. |
Constructor Summary | |
---|---|
AudioFileDataSource()
|
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, 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
public static final int PROP_BYTES_PER_READ_DEFAULT
@S4ComponentList(type=Configurable.class) public static final java.lang.String AUDIO_FILE_LISTENERS
Constructor Detail |
---|
public AudioFileDataSource()
Method Detail |
---|
public void newProperties(PropertySheet ps) throws PropertyException
Configurable
newProperties
in interface Configurable
newProperties
in class BaseDataProcessor
ps
- a property sheet holding the new data
PropertyException
- if there is a problem with the properties.public void initialize()
BaseDataProcessor
initialize
in interface DataProcessor
initialize
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 InputStreampublic Data getData() throws DataProcessingException
getData
in interface DataProcessor
getData
in class BaseDataProcessor
null
if none is available
DataProcessingException
- if there is a data processing errorpublic int getSampleRate()
public boolean isBigEndian()
public void addNewFileListener(AudioFileProcessListener l)
public void removeNewFileListener(AudioFileProcessListener l)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |