--- title: Web Speech API slug: Web/API/Web_Speech_API tags: - API - Experimental - Landing - NeedsTranslation - Reference - TopicStub - Web Speech API - recognition - speech - synthesis translation_of: Web/API/Web_Speech_API ---
{{DefaultAPISidebar("Web Speech API")}}{{seecompattable}}

The Web Speech API enables you to incorporate voice data into web apps. The Web Speech API has two parts: SpeechSynthesis (Text-to-Speech), and SpeechRecognition (Asynchronous Speech Recognition.)

Web Speech Concepts and Usage

The Web Speech API makes web apps able to handle voice data. There are two components to this API:

For more details on using these features, see Using the Web Speech API.

Web Speech API Interfaces

Speech recognition

{{domxref("SpeechRecognition")}}
The controller interface for the recognition service; this also handles the {{domxref("SpeechRecognitionEvent")}} sent from the recognition service.
{{domxref("SpeechRecognitionAlternative")}}
Represents a single word that has been recognised by the speech recognition service.
{{domxref("SpeechRecognitionError")}}
Represents error messages from the recognition service.
{{domxref("SpeechRecognitionEvent")}}
The event object for the {{event("result")}} and {{event("nomatch")}} events, and contains all the data associated with an interim or final speech recognition result.
{{domxref("SpeechGrammar")}}
The words or patterns of words that we want the recognition service to recognize.
{{domxref("SpeechGrammarList")}}
Represents a list of {{domxref("SpeechGrammar")}} objects.
{{domxref("SpeechRecognitionResult")}}
Represents a single recognition match, which may contain multiple {{domxref("SpeechRecognitionAlternative")}} objects.
{{domxref("SpeechRecognitionResultList")}}
Represents a list of {{domxref("SpeechRecognitionResult")}} objects, or a single one if results are being captured in {{domxref("SpeechRecognition.continuous","continuous")}} mode.

Speech synthesis

{{domxref("SpeechSynthesis")}}
The controller interface for the speech service; this can be used to retrieve information about the synthesis voices available on the device, start and pause speech, and other commands besides.
{{domxref("SpeechSynthesisErrorEvent")}}
Contains information about any errors that occur while processing {{domxref("SpeechSynthesisUtterance")}} objects in the speech service.
{{domxref("SpeechSynthesisEvent")}}
Contains information about the current state of {{domxref("SpeechSynthesisUtterance")}} objects that have been processed in the speech service.
{{domxref("SpeechSynthesisUtterance")}}
Represents a speech request. It contains the content the speech service should read and information about how to read it (e.g. language, pitch and volume.)
{{domxref("SpeechSynthesisVoice")}}
Represents a voice that the system supports. Every SpeechSynthesisVoice has its own relative speech service including information about language, name and URI.
{{domxref("Window.speechSynthesis")}}
Specced out as part of a [NoInterfaceObject] interface called SpeechSynthesisGetter, and Implemented by the Window object, the speechSynthesis property provides access to the {{domxref("SpeechSynthesis")}} controller, and therefore the entry point to speech synthesis functionality.

Examples

The Web Speech API repo on GitHub contains demos to illustrate speech recognition and synthesis.

Specifications

Specification Status Comment
{{SpecName('Web Speech API')}} {{Spec2('Web Speech API')}} Initial definition

Browser compatibility

SpeechRecognition

{{Compat("api.SpeechRecognition", 0)}}

SpeechSynthesis

{{Compat("api.SpeechSynthesis", 0)}}

See also