|
|||||||||
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.Microphone
public class Microphone
A Microphone captures audio data from the system's underlying audio input systems. Converts these audio data into Data objects. When the method
startRecording()
is called, a new thread will be created and used to
capture audio, and will stop when stopRecording()
is called. Calling getData()
returns the
captured audio data as Data objects. This Microphone will attempt to obtain an audio device with the format
specified in the configuration. If such a device with that format cannot be obtained, it will try to obtain a device
with an audio format that has a higher sample rate than the configured sample rate, while the other parameters of the
format (i.e., sample size, endianness, sign, and channel) remain the same. If, again, no such device can be obtained,
it flags an error, and a call startRecording
returns false.
Field Summary | |
---|---|
static java.lang.String |
PROP_BIG_ENDIAN
Property specify the endianness of the data. |
static java.lang.String |
PROP_BITS_PER_SAMPLE
SphinxProperty for the number of bits per value. |
static java.lang.String |
PROP_CHANNELS
Property specifying the number of channels. |
static java.lang.String |
PROP_CLOSE_BETWEEN_UTTERANCES
Sphinx property that specifies whether or not the microphone will release the audio between utterances. |
static java.lang.String |
PROP_KEEP_LAST_AUDIO
The Sphinx property that specifies whether to keep the audio data of an utterance around until the next utterance is recorded. |
static java.lang.String |
PROP_MSEC_PER_READ
The Sphinx property that specifies the number of milliseconds of audio data to read each time from the underlying Java Sound audio device. |
static java.lang.String |
PROP_SAMPLE_RATE
SphinxProperty for the sample rate of the data. |
static java.lang.String |
PROP_SELECT_CHANNEL
The Sphinx property that specifies the channel to use if the audio is stereo |
static java.lang.String |
PROP_SELECT_MIXER
The Sphinx property that specifies the mixer to use. |
static java.lang.String |
PROP_SIGNED
Property specify whether the data is signed. |
static java.lang.String |
PROP_STEREO_TO_MONO
The Sphinx property that specifies how to convert stereo audio to mono. |
Constructor Summary | |
---|---|
Microphone()
|
Method Summary | |
---|---|
void |
clear()
Clears all cached audio data. |
javax.sound.sampled.AudioFormat |
getAudioFormat()
Returns the format of the audio recorded by this Microphone. |
Data |
getData()
Reads and returns the next Data object from this Microphone, return null if there is no more audio data. |
Utterance |
getUtterance()
Returns the current Utterance. |
boolean |
hasMoreData()
Returns true if there is more data in the Microphone. |
void |
initialize()
Constructs a Microphone with the given InputStream. |
boolean |
isRecording()
Returns true if this Microphone is recording. |
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured. |
boolean |
startRecording()
Starts recording audio. |
void |
stopRecording()
Stops recording audio. |
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=16000) public static final java.lang.String PROP_SAMPLE_RATE
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_CLOSE_BETWEEN_UTTERANCES
@S4Integer(defaultValue=10) public static final java.lang.String PROP_MSEC_PER_READ
@S4Integer(defaultValue=16) public static final java.lang.String PROP_BITS_PER_SAMPLE
@S4Integer(defaultValue=1) public static final java.lang.String PROP_CHANNELS
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_BIG_ENDIAN
@S4Boolean(defaultValue=true) public static final java.lang.String PROP_SIGNED
@S4Boolean(defaultValue=false) public static final java.lang.String PROP_KEEP_LAST_AUDIO
@S4String(defaultValue="average", range={"average","selectChannel"}) public static final java.lang.String PROP_STEREO_TO_MONO
@S4Integer(defaultValue=0) public static final java.lang.String PROP_SELECT_CHANNEL
@S4String(defaultValue="default") public static final java.lang.String PROP_SELECT_MIXER
AudioTool
,
Constant Field ValuesConstructor Detail |
---|
public Microphone()
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()
initialize
in interface DataProcessor
initialize
in class BaseDataProcessor
java.io.IOException
- if an I/O error occurspublic javax.sound.sampled.AudioFormat getAudioFormat()
public Utterance getUtterance()
public boolean isRecording()
public boolean startRecording()
public void stopRecording()
public void clear()
public Data getData() throws DataProcessingException
startRecording()
and stopRecording()
is cached in an
Utterance object. Calling this method basically returns the next chunk of audio data cached in this Utterance.
getData
in interface DataProcessor
getData
in class BaseDataProcessor
null
if none is available
DataProcessingException
- if there is a data processing errorpublic boolean hasMoreData()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |