Rate this page:

ASREvents

Add the following line to your scenario code to use the events:

require(Modules.ASR);

Constants

ASRError

Copy URL

Triggers in case of errors during the recognition process.

Parameters

  • asr:

    ASR

    ASR instance that generated the event

  • error:

    string

    Error message

CaptureStarted

Copy URL

Triggers after ASR detected voice input and started collecting audio data for ASR.

Parameters

  • asr:

    ASR

    ASR instance that generated the event

InterimResult

Copy URL

Triggered when interim recognition result received from ASR. Note that event could be triggered only if the ASRParameters.interimResults option is set to true.

Parameters

  • asr:

    ASR

    ASR instance that generated the event

  • text:

    string

    Recognition result

Result

Copy URL

Triggered when recognition result received from ASR. We strongly recommend to create recognition timeout manually to prevent unexpectedly long recognition time..

Parameters

  • asr:

    ASR

    ASR instance that generated the event

  • channelTag:

    number

    Optional

    Optional. For multichannel audio, this is the channel number corresponding to the recognized result for the audio from that channel.

  • confidence:

    number

    Recognition confidence. Depending on the ASR provider, can be in 0..100 or 0..1 range (100 or 1 means full confidence, 0 - not confident at all)

  • languageCode:

    string

    Optional

    Optional. Output only. The BCP-47 language tag of the language in this result. This language code is detected to have the most likelihood of being spoken in the audio.

  • resultEndTime:

    string

    Optional

    Optional. Time offset of the end of this result relative to the beginning of the audio.

  • text:

    string

    Recognition result. Depending on the ASR provider, this parameter is called text or transcript (in rare cases).

SpeechCaptured

Copy URL

Triggers after ASR captured audio data, before recognition process.

Parameters

  • asr:

    ASR

    ASR instance that generated the event

Started

Copy URL

Triggers after ASR instance is created.

Parameters

  • asr:

    ASR

    ASR instance that generated the event

Stopped

Copy URL

Triggers as a result of the ASR.stop method call.

Parameters

  • asr:

    ASR

    ASR instance that generated the event

  • cost:

    string

    Record cost (in the account's currency: USD, EUR or RUB)

  • duration:

    number

    Record duration (sec)