public class RecorderSpeechRecognizer
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RecorderSpeechRecognizer.Error
Error type
|
static class |
RecorderSpeechRecognizer.RecognizeState
Recognize process state
|
static class |
RecorderSpeechRecognizer.RecordState
Recording state
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TAG |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancel all processes and give up to get recognition result.
|
static RecorderSpeechRecognizer |
create(IRecorderSpeechRecognizerListener listener,
APIConfiguration config)
Create a RecorderSpeechRecognizer instance.
|
static RecorderSpeechRecognizer |
create(IRecorderSpeechRecognizerListener listener,
SpeechRecognizer recognizer)
Create a RecorderSpeechRecognizer instance by a specified speech recognizer.
|
void |
enableSaveRecordToFile(boolean saveToFile,
java.lang.String fileName)
Enable/Disable to save the recorded audio to file.
|
RecorderSpeechRecognizer.RecognizeState |
getRecognizeState()
Get current recognize process state.
|
RecorderSpeechRecognizer.RecordState |
getRecordState()
Get current recording state.
|
void |
release()
Stop or cancel all processes and then release resources.
|
void |
setEndUserIdentifier(java.lang.String cusId)
Set the identification to identify the End-user.
|
void |
setLengthOfVADEnd(int milliseconds)
Set length of end time of the VAD in milliseconds to stop voice recording automatically.
|
void |
setListener(IRecorderSpeechRecognizerListener listener)
Set callback listener.
|
void |
setRecognizer(SpeechRecognizer recognizer)
Set speech recognizer.
|
void |
setResultQueryFrequency(int milliseconds)
Set the frequency in milliseconds of the recognition result query,
then the recognizer client will query the result once every milliseconds you set.
|
void |
setSpeechUploadLength(int milliseconds)
Set audio length in milliseconds to upload,
then the recognizer client will upload parts of audio once every milliseconds you set.
|
void |
setTimeout(int milliseconds)
Set timeout in milliseconds of each HTTP API request.
|
void |
start()
Enable microphone then start the voice recording and the recognize processing.
|
void |
stop()
Stop the voice recorder and wait for the final recognition result.
|
public static final java.lang.String TAG
public static RecorderSpeechRecognizer create(IRecorderSpeechRecognizerListener listener, APIConfiguration config)
listener - - The specified callback listener.config - - API configurations.public static RecorderSpeechRecognizer create(IRecorderSpeechRecognizerListener listener, SpeechRecognizer recognizer)
listener - - The specified callback listener.recognizer - - Configured speech recognizer.public void setListener(IRecorderSpeechRecognizerListener listener)
listener - The specified callback listener.public void setRecognizer(SpeechRecognizer recognizer)
recognizer - - Configured speech recognizer.public void setEndUserIdentifier(java.lang.String cusId)
cusId - - End-user identifier.public void setTimeout(int milliseconds)
milliseconds - - Timeout in milliseconds.public void setLengthOfVADEnd(int milliseconds)
milliseconds - - length of end time in milliseconds for the speech input idle.public void setSpeechUploadLength(int milliseconds)
milliseconds - - How long of the audio in milliseconds do you want to upload once.public void setResultQueryFrequency(int milliseconds)
milliseconds - - How long in milliseconds do you want to query once.public RecorderSpeechRecognizer.RecordState getRecordState()
public RecorderSpeechRecognizer.RecognizeState getRecognizeState()
public void start()
throws java.lang.InterruptedException,
java.lang.IllegalStateException
java.lang.InterruptedException - There is something wrong.java.lang.IllegalStateException - You are using this method in a wrong operation state.public void stop()
public void cancel()
public void release()
public void enableSaveRecordToFile(boolean saveToFile,
java.lang.String fileName)
saveToFile - - Set TRUE to enable, set FALSE to disable.fileName - - Name of the file you want to store the audio.