public class KeepRecordingSpeechRecognizer extends SpeechRecognizerBase
| Modifier and Type | Class and Description |
|---|---|
static class |
KeepRecordingSpeechRecognizer.Error
Error type
|
static class |
KeepRecordingSpeechRecognizer.RecognizeState
Recognize process state
|
AUDIO_COMPRESS_LIBRARY_TYPE_CPP, AUDIO_COMPRESS_LIBRARY_TYPE_JAVA, FRAME_LENGTH_MILLISECONDS, INSTANT_NOISE_LENGTH_MILLISECONDS, RECOGNIZE_RESULT_TYPE_ALL, RECOGNIZE_RESULT_TYPE_NLI, RECOGNIZE_RESULT_TYPE_STT, RECORD_FRAMES, RESERVED_INPUT_LENGTH_MILLISECONDS, SDK_TYPE, VAD_TAIL_SILENCE_LEVEL| Modifier and Type | Method and Description |
|---|---|
void |
cancelRecognizing()
Cancel all processes and give up to get recognition result.
|
static KeepRecordingSpeechRecognizer |
create(IKeepRecordingSpeechRecognizerListener recognizeListener,
ai.olami.cloudService.APIConfiguration config)
Create a KeepRecordingSpeechRecognizer instance.
|
static KeepRecordingSpeechRecognizer |
create(IKeepRecordingSpeechRecognizerListener recognizeListener,
ai.olami.cloudService.SpeechRecognizer recognizer)
Create a KeepRecordingSpeechRecognizer instance by a specified speech recognizer.
|
void |
enableSaveRecordToFIle(boolean saveToFile)
Enable/Disable to save the recorded audio to file.
|
void |
enableSaveRecordToFile(boolean saveToFile,
java.lang.String fileName)
Enable/Disable to save the recorded audio to file.
|
android.media.AudioRecord |
getAudioRecord()
Get AudioRecord that used by the KeepRecordingSpeechRecognizer instance.
|
KeepRecordingSpeechRecognizer.RecognizeState |
getRecognizeState()
Get current recognize process state.
|
void |
setApiRequestTimeout(int milliseconds)
Set timeout in milliseconds of each HTTP API request.
|
void |
setAudioRecord(android.media.AudioRecord audioRecord)
Set AudioRecord for the KeepRecordingSpeechRecognizer instance.
|
void |
setEndUserIdentifier(java.lang.String cusId)
Set the identification to identify the End-user.
|
void |
setListener(IKeepRecordingSpeechRecognizerListener listener)
Set callback listener.
|
void |
setRecognizer(ai.olami.cloudService.SpeechRecognizer recognizer)
Set speech recognizer.
|
void |
setRecognizerTimeout(int milliseconds)
Set timeout in milliseconds of each recognize process (begin-to-end).
|
void |
startRecognizing()
Start the recognize processing.
|
void |
startRecognizing(ai.olami.cloudService.NLIConfig nliConfig)
Start the recognize processing.
|
void |
startRecording()
Enable microphone then start the voice recording.
|
void |
stopRecognizing()
Stop the recognize process and wait for the final recognition result.
|
void |
stopRecordingAndReleaseResources()
Stop audio recording and release all resources.
|
getAudioCompressLibraryType, getFrameSize, getFrequencyToGettingResult, getMinFrequencyToGettingResult, getMinUploadAudioLengthMilliseconds, getRecognizeResultType, getRecordDataSize, getSilenceLevel, getUploadAudioLengthMilliseconds, getVADEndMilliseconds, setAudioCompressLibraryType, setFrameSize, setFrequencyToGettingResult, setLengthOfVADEnd, setMinFrequencyToGettingResult, setMinUploadAudioLengthMilliseconds, setRecognizeResultType, setRecordDataSize, setResultQueryFrequency, setSilenceLevel, setSilenceLevelOfVADTail, setSpeechUploadLength, setUploadAudioLengthMilliseconds, setVADEndMillisecondspublic static KeepRecordingSpeechRecognizer create(IKeepRecordingSpeechRecognizerListener recognizeListener, ai.olami.cloudService.APIConfiguration config) throws java.lang.Exception
recognizeListener - - The specified callback listener.config - - API configurations.java.lang.Exceptionpublic static KeepRecordingSpeechRecognizer create(IKeepRecordingSpeechRecognizerListener recognizeListener, ai.olami.cloudService.SpeechRecognizer recognizer) throws java.lang.Exception
recognizeListener - - The specified callback listener.recognizer - - Configured speech recognizer.java.lang.Exceptionpublic void setListener(IKeepRecordingSpeechRecognizerListener listener)
listener - The specified callback listener.public void setRecognizer(ai.olami.cloudService.SpeechRecognizer recognizer)
recognizer - - Configured speech recognizer.public void setEndUserIdentifier(java.lang.String cusId)
cusId - - End-user identifier.public void setApiRequestTimeout(int milliseconds)
milliseconds - - Timeout in milliseconds.public void setRecognizerTimeout(int milliseconds)
milliseconds - - Timeout in milliseconds. Default is 5000.public KeepRecordingSpeechRecognizer.RecognizeState getRecognizeState()
public void stopRecordingAndReleaseResources()
public void startRecording()
throws java.lang.Exception
java.lang.Exception - There is something wrong.public void startRecognizing()
throws java.lang.InterruptedException
java.lang.InterruptedException - There is something wrong.public void startRecognizing(ai.olami.cloudService.NLIConfig nliConfig)
throws java.lang.InterruptedException
nliConfig - - NLIConfig object.java.lang.InterruptedException - There is something wrong.public void stopRecognizing()
public void cancelRecognizing()
public android.media.AudioRecord getAudioRecord()
public void setAudioRecord(android.media.AudioRecord audioRecord)
public void enableSaveRecordToFIle(boolean saveToFile)
saveToFile - - Set TRUE to enable, set FALSE to disable.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.