Skip to content

SpeechRecognizer

Outgoing Messages

WakewordDetected

Notifies the platform implementation when a wake word is detected.

JSON Structure

{
    "header": {
        "version": "4.0",
        "messageType": "Publish",
        "id": {{String}},
        "messageDescription": {
            "topic": "SpeechRecognizer",
            "action": "WakewordDetected"
        }
    },
    "payload": {
        "wakeword": {{String}}        
    }
}

Payload

Property Type Required Description Example
wakeword String Yes The wake word that was detected.

EndOfSpeechDetected

Notifies the platform implementation when end of speech is detected for the current recognize event.

JSON Structure

{
    "header": {
        "version": "4.0",
        "messageType": "Publish",
        "id": {{String}},
        "messageDescription": {
            "topic": "SpeechRecognizer",
            "action": "EndOfSpeechDetected"
        }
    }
}

Incoming Messages

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.

JSON Structure

{
    "header": {
        "version": "4.0",
        "messageType": "Publish",
        "id": {{String}},
        "messageDescription": {
            "topic": "SpeechRecognizer",
            "action": "StopCapture"
        }
    }
}

StartCapture

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.

JSON Structure

{
    "header": {
        "version": "4.0",
        "messageType": "Publish",
        "id": {{String}},
        "messageDescription": {
            "topic": "SpeechRecognizer",
            "action": "StartCapture"
        }
    },
    "payload": {
        "initiator": {{Initiator}},
        "keywordBegin": {{Int}},
        "keywordEnd": {{Int}},
        "keyword": {{String}}        
    }
}

Payload

Property Type Required Description Example
initiator Initiator Yes Initiator type for the speech recognition event.
keywordBegin Int No (default: -1) The sample index where the keyword begins. Must be provided when initiator type is WAKEWORD.
keywordEnd Int No (default: -1) The sample index where the keyword ends. Must be provided when initiator type is WAKEWORD.
keyword String No The keyword being recognized, e.g. alexa. Must be provided when initiator type is WAKEWORD.

Enums

Initiator

Values

Value Description
"HOLD_TO_TALK" Hold-to-talk speech initiator type.
"TAP_TO_TALK" Tap-to-talk speech initiator type.
"WAKEWORD" Wakeword speech initiator type.