The SpeechSynthesis interface of the Web Speech API is 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.

Documentation SpeechSynthesis by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Variables

onvoiceschanged:Function

Fired when the list of SpeechSynthesisVoice objects that would be returned by the SpeechSynthesis.getVoices() method has changed.

read onlypaused:Bool

A Boolean that returns true if the SpeechSynthesis object is in a paused state.

read onlypending:Bool

A Boolean that returns true if the utterance queue contains as-yet-unspoken utterances.

read onlyspeaking:Bool

A Boolean that returns true if an utterance is currently in the process of being spoken — even if SpeechSynthesis is in a paused state.

Methods

cancel():Void

Removes all utterances from the utterance queue.

getVoices():Array<SpeechSynthesisVoice>

Returns a list of SpeechSynthesisVoice objects representing all the available voices on the current device.

pause():Void

Puts the SpeechSynthesis object into a paused state.

resume():Void

Puts the SpeechSynthesis object into a non-paused state: resumes it if it was already paused.

speak(utterance:SpeechSynthesisUtterance):Void

Adds an SpeechSynthesisUtterance to the utterance queue; it will be spoken when any other utterances queued before it have been spoken.

Inherited Variables

Inherited Methods

Defined by EventTarget

addEventListener(type:String, listener:Function, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

addEventListener(type:String, listener:EventListener, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

Register an event handler of a specific event type on the EventTarget.

Throws:

null

DOMError

dispatchEvent(event:Event):Bool

Dispatch an event to this EventTarget.

Throws:

null

DOMError

removeEventListener(type:String, listener:Function, ?options:EitherType<EventListenerOptions, Bool>):Void

removeEventListener(type:String, listener:EventListener, ?options:EitherType<EventListenerOptions, Bool>):Void

Removes an event listener from the EventTarget.

Throws:

null

DOMError