SpeechRecognizer should be extended to initiate voice interactions with Alexa. SpeechRecognizer provides interfaces for
- Initiating a dialog interaction with Alexa via press-and-hold, press-and-release, and voice-initiated user actions
- Enabling and disabling the wake word engine
- Handling wake word and end of speech detection
- Note
- For observing Alexa dialog state transitions, see
AlexaClient.dialogStateChanged()
.
◆ wakewordDetected()
boolean com.amazon.aace.alexa.SpeechRecognizer.wakewordDetected |
( |
String |
wakeword | ) |
|
Notifies the platform implementation when a wake word is detected
- Parameters
-
wakeword | The wake word that was detected |
- Returns
true
if the Engine should initiate a recognize event, false
if the Engine should ignore the invocation
◆ endOfSpeechDetected()
void com.amazon.aace.alexa.SpeechRecognizer.endOfSpeechDetected |
( |
| ) |
|
Notifies the platform implementation when end of speech is detected for the current recognize event
◆ holdToTalk()
final boolean com.amazon.aace.alexa.SpeechRecognizer.holdToTalk |
( |
| ) |
|
Notifies the Engine of a speech recognition event initiated by a press-and-hold action on the platform. The Engine will call startAudioInput()
to notify the platform implementation when to start writing audio samples. The platform implementation should call stopCapture()
to terminate speech recognition on release of the press-and-hold action.
- Returns
true
if the Engine successfully initiated a recognize event, else false
◆ tapToTalk()
final boolean com.amazon.aace.alexa.SpeechRecognizer.tapToTalk |
( |
| ) |
|
Notifies the Engine of a speech recognition event initiated by a press-and-release action on the platform. The Engine will call startAudioInput()
to notify the platform implementation when to start writing audio samples. The Engine will terminate the recognize event initiated by the press-and-release action when end of speech is detected.
- Returns
true
if the Engine successfully started a recognize event, else false
◆ startCapture()
final boolean com.amazon.aace.alexa.SpeechRecognizer.startCapture |
( |
Initiator |
initiator, |
|
|
long |
keywordBegin, |
|
|
long |
keywordEnd, |
|
|
String |
keyword |
|
) |
| |
Notifies the Engine of a speech recognition event. The Engine will call startAudioInput()
to notify the platform implementation when to start writing audio samples. If the initator type is HOLD_TO_TALK
, then the platform implementation should call stopCapture()
to terminate speech recognition on release of the press-and-hold action. Otherwise, the Engine will terminate the recognize event when end of speech is detected.
- Parameters
-
initiator | The Initiator type for the speech recognition event |
keywordBegin | The sample index where the keyword begins. This is required when the initator type is WAKEWORD , otherwise should be set to UNSPECIFIED_INDEX . |
keywordEnd | The sample index where the keyword ends. This is required when the initator type is WAKEWORD , otherwise should be set to UNSPECIFIED_INDEX . |
keyword | The keyword being recognized, e.g. "alexa". This is required when the initator type is WAKEWORD , otherwise should be set to null. |
- Returns
true
if the Engine successfully started a recognize event, else false
◆ stopCapture()
final boolean com.amazon.aace.alexa.SpeechRecognizer.stopCapture |
( |
| ) |
|
Notifies the Engine to terminate the current recognize event. The Engine will call stopAudioInput()
to notify the platform implementation when to stop writing audio samples.
- Returns
true
if the Engine successfully terminated the current recognize event, else false
◆ enableWakewordDetection()
final boolean com.amazon.aace.alexa.SpeechRecognizer.enableWakewordDetection |
( |
| ) |
|
Notifies the Engine to enable the wake word engine. Wake word must be supported in the Engine to be enabled by this call.
- Returns
true
if the Engine successfully enabled wake word detection, else false
◆ disableWakewordDetection()
final boolean com.amazon.aace.alexa.SpeechRecognizer.disableWakewordDetection |
( |
| ) |
|
Notifies the Engine to disable the wake word engine
- Returns
true
if the Engine successfully disabled wakeword detection, else false
◆ isWakewordDetectionEnabled()
final boolean com.amazon.aace.alexa.SpeechRecognizer.isWakewordDetectionEnabled |
( |
| ) |
|
Checks if wake word detection is enabled in the Engine
- Returns
true
if wake word detection is enabled, else false
Alexa Auto SDK 2.0.0 - Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0