|
|||||||||
| 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.WavWriter
public class WavWriter
Stores audio data into numbered (MS-)wav files. TODO: currently the WavWriter is only able to write data in bigEndian, support for littleEndian would be nice TODO: currently the WavWriter buffers all audio data until a DataEndSignal occurs.
| Field Summary | |
|---|---|
static java.lang.String |
PROP_BITS_PER_SAMPLE
SphinxProperty for the number of bits per value. |
static java.lang.String |
PROP_CAPTURE_UTTERANCES
The SphinxProperty specifying whether the input data is signed. |
static java.lang.String |
PROP_IS_COMPLETE_PATH
|
static java.lang.String |
PROP_OUT_FILE_NAME_PATTERN
The pathname which must obey the pattern: pattern + i + .wav. |
static java.lang.String |
PROP_SIGNED_DATA
The SphinxProperty specifying whether the input data is signed. |
| Constructor Summary | |
|---|---|
WavWriter()
|
|
WavWriter(java.lang.String dumpFilePath,
boolean isCompletePath,
int bitsPerSample,
boolean isSigned,
boolean captureUtts)
|
|
| Method Summary | |
|---|---|
static javax.sound.sampled.AudioInputStream |
convertDoublesToAudioStream(double[] values,
int sampleRate)
|
Data |
getData()
Returns the processed Data output. |
void |
initialize()
Initializes this DataProcessor. |
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured. |
static byte[] |
valuesToBytes(double[] values,
int bytesPerValue,
boolean signedData)
Converts a big-endian byte array into an array of doubles. |
static void |
writeWavFile(double[] signal,
int sampleRate,
java.io.File targetFile)
Writes a given double array into a wav file (given the sample rate of the signal). |
| 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 |
|---|
@S4String public static final java.lang.String PROP_OUT_FILE_NAME_PATTERN
@S4Boolean(defaultValue=false) public static final java.lang.String PROP_IS_COMPLETE_PATH
@S4Integer(defaultValue=16) public static final java.lang.String PROP_BITS_PER_SAMPLE
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_SIGNED_DATA
@S4Boolean(defaultValue=false) public static final java.lang.String PROP_CAPTURE_UTTERANCES
| Constructor Detail |
|---|
public WavWriter(java.lang.String dumpFilePath,
boolean isCompletePath,
int bitsPerSample,
boolean isSigned,
boolean captureUtts)
public WavWriter()
| 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 Data getData()
throws DataProcessingException
BaseDataProcessor
getData in interface DataProcessorgetData in class BaseDataProcessorDataProcessingException - if a data processor error occurspublic void initialize()
initialize in interface DataProcessorinitialize in class BaseDataProcessor
public static byte[] valuesToBytes(double[] values,
int bytesPerValue,
boolean signedData)
throws java.lang.ArrayIndexOutOfBoundsException
values - bytesPerValue - the number of bytes per valuesignedData - whether the data is signed
null if byteArray is of zero length
java.lang.ArrayIndexOutOfBoundsException
public static javax.sound.sampled.AudioInputStream convertDoublesToAudioStream(double[] values,
int sampleRate)
public static void writeWavFile(double[] signal,
int sampleRate,
java.io.File targetFile)
signal - sampleRate - targetFile -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||