voxxy

Reference v0.1.2

voxxy/tts/platform

The browser's own speech synthesis.

import { … } from "voxxy/tts/platform"

Functions

detectPlatformTts function

function detectPlatformTts(): boolean

Whether this browser has speech synthesis (speechSynthesis). Safe to call anywhere.

voiceLocality function

function voiceLocality(voice: SpeechSynthesisVoice): Locality

Whether a browser voice runs on the device ("local"), on a service ("cloud"), or the browser does not say ("unknown").

platformVoices function

function platformVoices(lang: string, signal?: AbortSignal): Promise<SpeechSynthesisVoice[]>

Reads voices without speaking. Browsers may populate the list asynchronously.

platformTts function

function platformTts(__namedParameters?: PlatformTtsOptions): TtsProvider

Speech synthesis by the browser's own voices, as a TtsProvider. It needs no download. Pick locality to say whether the text may leave the device, and show a notice when it is "cloud". Reports "unavailable" when no voice of that kind exists for the language; list the choices with platformVoices().

Interfaces

PlatformTtsOptions interface

interface PlatformTtsOptions

Options for platformTts(). All of them are optional.

lang?: string

Language to speak, as a BCP 47 tag. Default "en-US".

voice?: string

The name or URI shown by the browser.

locality?: Locality

Which kind of voice to use: "local" (default) runs on the device, "cloud" may send the text to a service.