The speech recognition part of the Web Speech API allows authorized web applications to access the device's microphone and produces a transcript of the voice being recorded. This allows web applications to use voice as one of the input & control method, similar to touch or keyboard.
Technically, the speech recognition functionality can also be achieved by accessing the microphone and processing the audio stream using Web Audio API. An examplary library that takes such an approach is pocketsphinx.js.
let recognition = new SpeechRecognition()
- Creates an object used to configure the recognition process and to receive events about the recognition results.
- A boolean property indicating whether the process should stop after the first final transcripts received (when
false, the default) or send multiple events, until the process is explicitly stopped (when
- A boolean property indicating whether interim (not-yet-final) transcripts should be provided,
- A property to set up the language for the recognition.
- An event fired when the process has produced the transcripts for the piece of audio recorded. The listener is called with an array of results, each containing a boolean
finalflag indicating whether the result might be updated in the future event (when
false) or not and the collection of alternative transcripts, each with
transcriptitself and a
- An event fired when the process has not produced any transcripts for the piece of audio recorded with the confidence exceeding the minimal threshold, i.e. it is not possible to provide the transcription.
- Starts the recognition process.
- Stops the recognition process; useful when
recognition.continuousis set to