Skip to content

WebSpeech

Types

speechSynthesis

This Web Speech API interface 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. See SpeechSynthesis on MDN

type speechSynthesis = private {
pending: bool,
speaking: bool,
paused: bool,
}

Record fields

pending
bool
speaking
bool
paused
bool

speechSynthesisUtterance

This Web Speech API interface 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.) See SpeechSynthesisUtterance on MDN TODO: mark as private once mutating fields of private records is allowed

type speechSynthesisUtterance = {
mutable text: string,
mutable lang: string,
mutable voice: Null.t<speechSynthesisVoice>,
mutable volume: float,
mutable rate: float,
mutable pitch: float,
}

Record fields

text
string
lang
string
volume
float
rate
float
pitch
float

speechSynthesisVoice

This Web Speech API interface represents a voice that the system supports. Every SpeechSynthesisVoice has its own relative speech service including information about language, name and URI. See SpeechSynthesisVoice on MDN

type speechSynthesisVoice = {
voiceURI: string,
name: string,
lang: string,
localService: bool,
default: bool,
}

Record fields

voiceURI
string
name
string
lang
string
localService
bool
default
bool