← Back to Examples

Voice Selector

The second argument to speak() can take three shapes — by name, by pattern, or by query. Pick a mode to see each one in action.

String selector. Pass the exact voice name. Predictable and explicit — but brittle if the voice isn't on the user's platform; the matching chain then picks the closest alternative.
NameLanguageGenderType
Initializing…
RegExp selector. Match any voice whose name fits the pattern — useful when you want a family of voices ("any Portuguese variant") rather than one specific name. The first match wins.
First match wins; others greyed.
NameLanguageMatch
Initializing…

VoiceQuery selector. A structured filter object — the same JSON-serializable shape that the SDKs in other languages (Python, Go, PHP, Java) and server-side configs use. Every field you set must be true for a voice to match (logical AND).

Note: provider and isByok: true both target premium voices that route through BYOK (bring-your-own-keys) services.

Showing client-side preview of matches.
NameLanguageGenderProvider
Initializing…

Preview

// Choose a voice above to see the speak() call here.
Initializing…