Reference v0.1.2
voxxy/tts/platform
The browser's own speech synthesis.
import { … } from "voxxy/tts/platform"
Functions
detectPlatformTts function
function detectPlatformTts(): booleanWhether this browser has speech synthesis (speechSynthesis). Safe to call anywhere.
voiceLocality function
function voiceLocality(voice: SpeechSynthesisVoice): LocalityWhether 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): TtsProviderSpeech 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 PlatformTtsOptionsOptions for platformTts(). All of them are optional.
lang?: stringLanguage to speak, as a BCP 47 tag. Default "en-US".
voice?: stringThe name or URI shown by the browser.
locality?: LocalityWhich kind of voice to use: "local" (default) runs on the device, "cloud" may send the text to a service.