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 SpeechSynthesis

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.

MDN Reference

interface SpeechSynthesis {
    onvoiceschanged: ((this: SpeechSynthesis, ev: Event) => any) | null;
    paused: boolean;
    pending: boolean;
    speaking: boolean;
    addEventListener<K extends "voiceschanged">(
        type: K,
        listener: (this: SpeechSynthesis, ev: SpeechSynthesisEventMap[K]) => any,
        options?: boolean | AddEventListenerOptions,
    ): void;
    addEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | AddEventListenerOptions,
    ): void;
    cancel(): void;
    dispatchEvent(event: Event): boolean;
    getVoices(): SpeechSynthesisVoice[];
    pause(): void;
    removeEventListener<K extends "voiceschanged">(
        type: K,
        listener: (this: SpeechSynthesis, ev: SpeechSynthesisEventMap[K]) => any,
        options?: boolean | EventListenerOptions,
    ): void;
    removeEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | EventListenerOptions,
    ): void;
    resume(): void;
    speak(utterance: SpeechSynthesisUtterance): void;
}

Hierarchy

  • EventTarget
    • SpeechSynthesis
Index
onvoiceschanged: ((this: SpeechSynthesis, ev: Event) => any) | null
paused: boolean

The paused read-only property of the SpeechSynthesis interface is a boolean value that returns true if the SpeechSynthesis object is in a paused state, or false if not.

MDN Reference

pending: boolean

The pending read-only property of the SpeechSynthesis interface is a boolean value that returns true if the utterance queue contains as-yet-unspoken utterances.

MDN Reference

speaking: boolean

The speaking read-only property of the SpeechSynthesis interface is a boolean value that returns true if an utterance is currently in the process of being spoken — even if SpeechSynthesis is in a paused state.

MDN Reference

  • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    Type Parameters

    • K extends "voiceschanged"

    Parameters

    Returns void

  • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    Parameters

    Returns void

  • The cancel() method of the SpeechSynthesis interface removes all utterances from the utterance queue.

    MDN Reference

    Returns void

  • 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 pause() method of the SpeechSynthesis interface puts the SpeechSynthesis object into a paused state.

    MDN Reference

    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

    Type Parameters

    • K extends "voiceschanged"

    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

  • The resume() method of the SpeechSynthesis interface puts the SpeechSynthesis object into a non-paused state: resumes it if it was already paused.

    MDN Reference

    Returns void

Was this helpful?