web-speech-cognitive-services
Polyfill Web Speech API with Cognitive Services.
Event lifecycle mapping from Cognitive Services
# | WebSpeech | Cognitive Services | Notes |
---|
1 | start | RecognitionTriggeredEvent | |
2 | audiostart | ListeningStartedEvent | |
3 | | ConnectingToServiceEvent | |
4 | soundstart , speechstart | RecognitionStartedEvent | |
5 | onresult(isFinal = false) | SpeechHypothesisEvent | |
6 | speechend , soundend , audioend | SpeechEndDetectedEvent | speechend and soundend only fire if either speechstart and soundstart was fired |
7 | onresult(isFinal = true) , onerror | SpeechSimplePhraseEvent | |
8 | end | RecognitionEndedEvent | |
Scenarios
- Happy path
RecognitionTriggeredEvent
ListeningStartedEvent
ConnectingToServiceEvent
RecognitionStartedEvent
SpeechHypothesisEvent
(could be more than one)SpeechEndDetectedEvent
SpeechSimplePhraseEvent
RecognitionEndedEvent
- Network issues
RecognitionTriggeredEvent
ListeningStartedEvent
ConnectingToServiceEvent
SpeechSimplePhraseEvent
RecognitionEndedEvent
- Audio muted or volume too low
RecognitionTriggeredEvent
ListeningStartedEvent
ConnectingToServiceEvent
RecognitionStartedEvent
SpeechEndDetectedEvent
SpeechSimplePhraseEvent(Result.RecognitionStatus = 'InitialSilenceTimeout')
RecognitionEndedEvent
- Failed to recognize speech (a.k.a. no match)
RecognitionTriggeredEvent
ListeningStartedEvent
ConnectingToServiceEvent
RecognitionStartedEvent
SpeechHypothesisEvent
(could be more than one)SpeechEndDetectedEvent
SpeechSimplePhraseEvent(Result.RecognitionStatus = 'NoMatch')
RecognitionEndedEvent
- User abort
- Essentially muted the speech, that could result in success, silent, or no match
- Not authorized to use microphone
RecognitionTriggeredEvent
RecognitionEndedEvent(Result.RecognitionStatus = 'AudioSourceError')
Contributions
Like us? Star us.
Want to make it better? File us an issue.
Don't like something you see? Submit a pull request.