public class SpeechRecognizerDbmHandler extends DbmHandler<Float> implements RecognitionListener
DbmHandler for SpeechRecognizer.
Note: make sure you're calling AudioVisualization.onPause() when
RecognitionListener.onEndOfSpeech() event called to stop visualizing.DbmHandler.Factory| Modifier and Type | Method and Description |
|---|---|
RecognitionListener |
innerRecognitionListener()
Get inner recognition listener.
|
SpeechRecognizerDbmHandler |
innerRecognitionListener(RecognitionListener innerRecognitionListener)
Set inner recognition listener.
|
void |
onBeginningOfSpeech() |
void |
onBufferReceived(byte[] buffer) |
protected void |
onDataReceivedImpl(Float rmsdB,
int layersCount,
float[] dBmArray,
float[] ampsArray)
Implement your own data conversion.
|
void |
onEndOfSpeech() |
void |
onError(int error) |
void |
onEvent(int eventType,
Bundle params) |
void |
onPartialResults(Bundle partialResults) |
void |
onReadyForSpeech(Bundle params) |
void |
onResults(Bundle results) |
void |
onRmsChanged(float rmsdB) |
void |
release()
Called after
AudioVisualization.release() ()} call. |
void |
startListening(Intent recognitionIntent)
Start listening for speech.
|
void |
stopListening()
Stop listening for speech.
|
calmDownAndStopRendering, onDataReceived, onPause, onResume, startRendering, stopRenderingpublic void startListening(Intent recognitionIntent)
recognitionIntent - contains parameters for the recognition to be performedSpeechRecognizer.startListening(Intent)public void stopListening()
SpeechRecognizer.stopListening()public SpeechRecognizerDbmHandler innerRecognitionListener(RecognitionListener innerRecognitionListener)
innerRecognitionListener - inner recognition listenerpublic RecognitionListener innerRecognitionListener()
protected void onDataReceivedImpl(Float rmsdB, int layersCount, float[] dBmArray, float[] ampsArray)
DbmHandleronDataReceivedImpl in class DbmHandler<Float>rmsdB - any datalayersCount - layers countdBmArray - array of normalized (in range [0..1]) dBm values that should be populated by you.
Array size is equals to layersCount value.ampsArray - array of amplitude values that should be populated by you.
Array size is equals to layersCount value.public void release()
DbmHandlerAudioVisualization.release() ()} call.release in class DbmHandler<Float>public void onReadyForSpeech(Bundle params)
onReadyForSpeech in interface RecognitionListenerpublic void onBeginningOfSpeech()
onBeginningOfSpeech in interface RecognitionListenerpublic void onRmsChanged(float rmsdB)
onRmsChanged in interface RecognitionListenerpublic void onBufferReceived(byte[] buffer)
onBufferReceived in interface RecognitionListenerpublic void onEndOfSpeech()
onEndOfSpeech in interface RecognitionListenerpublic void onError(int error)
onError in interface RecognitionListenerpublic void onResults(Bundle results)
onResults in interface RecognitionListenerpublic void onPartialResults(Bundle partialResults)
onPartialResults in interface RecognitionListenerpublic void onEvent(int eventType,
Bundle params)
onEvent in interface RecognitionListener