Join us online - 19th of November
Save your spot
For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface SpeechSynthesisUtterance

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

MDN Reference

interface SpeechSynthesisUtterance {
    lang: string;
    onboundary:
        | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
        | null;
    onend:
        | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
        | null;
    onerror:
        | (
            (this: SpeechSynthesisUtterance, ev: SpeechSynthesisErrorEvent) => any
        )
        | null;
    onmark:
        | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
        | null;
    onpause:
        | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
        | null;
    onresume:
        | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
        | null;
    onstart:
        | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
        | null;
    pitch: number;
    rate: number;
    text: string;
    voice: SpeechSynthesisVoice | null;
    volume: number;
    addEventListener<K extends keyof SpeechSynthesisUtteranceEventMap>(
        type: K,
        listener: (
            this: SpeechSynthesisUtterance,
            ev: SpeechSynthesisUtteranceEventMap[K],
        ) => any,
        options?: boolean | AddEventListenerOptions,
    ): void;
    addEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | AddEventListenerOptions,
    ): void;
    dispatchEvent(event: Event): boolean;
    removeEventListener<K extends keyof SpeechSynthesisUtteranceEventMap>(
        type: K,
        listener: (
            this: SpeechSynthesisUtterance,
            ev: SpeechSynthesisUtteranceEventMap[K],
        ) => any,
        options?: boolean | EventListenerOptions,
    ): void;
    removeEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | EventListenerOptions,
    ): void;
}

Hierarchy

  • EventTarget
    • SpeechSynthesisUtterance
Index
lang: string

The lang property of the SpeechSynthesisUtterance interface gets and sets the language of the utterance.

MDN Reference

onboundary:
    | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
    | null
onend:
    | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
    | null
onerror:
    | (
        (this: SpeechSynthesisUtterance, ev: SpeechSynthesisErrorEvent) => any
    )
    | null
onmark:
    | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
    | null
onpause:
    | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
    | null
onresume:
    | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
    | null
onstart:
    | ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any)
    | null
pitch: number

The pitch property of the SpeechSynthesisUtterance interface gets and sets the pitch at which the utterance will be spoken at.

MDN Reference

rate: number

The rate property of the SpeechSynthesisUtterance interface gets and sets the speed at which the utterance will be spoken at.

MDN Reference

text: string

The text property of the SpeechSynthesisUtterance interface gets and sets the text that will be synthesized when the utterance is spoken.

MDN Reference

voice: SpeechSynthesisVoice | null

The voice property of the SpeechSynthesisUtterance interface gets and sets the voice that will be used to speak the utterance.

MDN Reference

volume: number

The volume property of the SpeechSynthesisUtterance interface gets and sets the volume that the utterance will be spoken at.

MDN Reference

  • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

    MDN Reference

    Parameters

    • event: Event

    Returns boolean

  • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

    MDN Reference

    Type Parameters

    Parameters

    Returns void

  • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.

    MDN Reference

    Parameters

    Returns void

Was this helpful?