Overview | Package | Class | Tree | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.EventObject | +--javax.speech.SpeechEvent | +--javax.speech.AudioEvent | +--javax.speech.recognition.RecognizerAudioEvent
RecognizerAudioEvents
are issued to each
RecognizerAudioListener
attached to the
AudioManager
for a Recognizer
.
RecognizerAudioListener
events are timed
with the input audio. In most architectures this
indicates that the events occur in near to real time.
SPEECH_STARTED
and SPEECH_STOPPED
The SPEECH_STARTED
and SPEECH_STOPPED
events are used to indicate possible detection of speech
in the incoming audio. Applications may use this event to
display visual feedback to a user indicating that the recognizer
is listening - for example, by maintaining a icon indicating
microphone status.
It is sometimes difficult to quickly distinguish between
speech and other noises (e.g. coughs, microphone bumps),
so the SPEECH_STARTED
event is not always
followed by a Result
.
If a RESULT_CREATED
is issued for the detected speech,
it will usually occur soon after the SPEECH_STARTED
event but may be delayed for a number of reasons.
RESULT_CREATED
until it is confident that it has detected speech that matches
one of the active grammars - in some cases the RESULT_CREATED
may be issued at the end of the spoken sentence.
SUSPENDED
state causing it to buffer audio
and "catch up" once it returns to the LISTENING
state.
Some recognizers will allow a user to speak more than one commands
without a break. In these cases, a single SPEECH_STARTED
event may be followed by more than one RESULT_CREATED
event
and result finalization before the SPEECH_STOPPED
event
is issued.
In longer speech (e.g. dictating a paragraph), short pauses in
the user's speech may lead to a SPEECH_STOPPED
event
followed by a SPEECH_STARTED
event as the user resumes
speaking. These events do not always indicate that the current
result will be finalized.
In short, applications should treat the SPEECH_STARTED
and SPEECH_STOPPED
events as operating entirely
independently from the result system of a Recognizer
.
An AUDIO_LEVEL
event indicates a change in the volume of the
audio input to a recognizer. The level is defined on a scale from
0 to 1. 0.0 represents silence. 0.25 represents quiet input.
0.75 represents loud input. 1.0 indicates the maximum level.
Audio level events are suitable for display of a visual "VU meter" (like the bar on stereo systems which goes up and down with the volume). Different colors are often used to indicate the different levels: for example, red for loud, green for normal, and blue for background.
Maintaining audio quality is important for reliable recognition. A common problem is a user speaking too loudly or too quietly. The color on a VU meter is one way to provide feedback to the user. Note that a quiet level (below 0.25) does not necessarily indicate that the user is speaking too quietly. The input is also quiet when the user is not speaking.
Field Summary | |
static int | AUDIO_LEVEL
AUDIO_LEVEL event indicates a change in the
volume level of the incoming audio.
|
float | audioLevel
Audio level defined on a scale from 0 to 1. |
static int | SPEECH_STARTED
The recognizer has detected the possible start of speech in the incoming audio. |
static int | SPEECH_STOPPED
The recognizer has detected the end of speech or noise in the incoming audio that it previously indicated by a SPEECH_STARTED event.
|
Fields inherited from class javax.speech.SpeechEvent | |
id |
Fields inherited from class java.util.EventObject | |
source |
Constructor Summary | |
RecognizerAudioEvent(Recognizer source,
int id,
float audioLevel)
Constructs an RecognizerAudioEvent with a specified
event identifier and audio level.
|
|
RecognizerAudioEvent(Recognizer source,
int id)
Constructs an RecognizerAudioEvent with a specified
event identifier.
|
Method Summary | |
float | getAudioLevel()
Get the audio input level in the range 0 to 1. A value below 0.25 indicates quiet input with 0.0 being silence. |
String | paramString()
Returns a parameter string identifying this event. |
Methods inherited from class javax.speech.AudioEvent | |
paramString |
Methods inherited from class javax.speech.SpeechEvent | |
getId, paramString, toString |
Methods inherited from class java.util.EventObject | |
getSource, toString |
Methods inherited from class java.lang.Object | |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
Field Detail |
public static final int SPEECH_STARTED
A detailed description of SPEECH_STARTED
and
SPEECH_STOPPED
events is provided above.
public static final int SPEECH_STOPPED
SPEECH_STARTED
event.
This event always follows a SPEECH_STARTED
event.
A detailed description of SPEECH_STARTED
and
SPEECH_STOPPED
events is provided above.
public static final int AUDIO_LEVEL
AUDIO_LEVEL
event indicates a change in the
volume level of the incoming audio.
A detailed description of the AUDIO_LEVEL
event is provided above.
protected float audioLevel
Constructor Detail |
public RecognizerAudioEvent(Recognizer source, int id, float audioLevel)
RecognizerAudioEvent
with a specified
event identifier and audio level.
The audioLevel
should be 0.0
for SPEECH_STARTED
and SPEECH_STOPPED
events.
source
- the Recognizer
that issued the event
id
- the identifier for the event type
audioLevel
- the audio level for this eventpublic RecognizerAudioEvent(Recognizer source, int id)
RecognizerAudioEvent
with a specified
event identifier.
The audioLevel
is set to 0.0
.
source
- the Recognizer
that issued the event
id
- the identifier for the event typeMethod Detail |
public float getAudioLevel()
The level is provided only for the AUDIO_LEVEL
event type.
The level should be ignored for SPEECH_STARTED
and SPEECH_STOPPED
events.
public String paramString()
Overview | Package | Class | Tree | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Speech API
Copyright 1997-1998 Sun Microsystems, Inc. All rights reserved
Send comments to javaspeech-comments@sun.com