> ## Documentation Index
> Fetch the complete documentation index at: https://docs.responsivevoice.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Voice Selector Example

Three tabs, one preview pane. Pick a voice by exact **name**, by **RegExp pattern**, or by **VoiceQuery** — the snippet at the bottom rewrites itself as you switch, so you can see what each form looks like at the `speak()` call site.

> [!TIP]
> [Live demo](https://examples.responsivevoice.org/browser/voice-selector/) · [Source code](https://github.com/responsivevoice/examples/tree/main/browser/voice-selector)

## Why three modes

The [Voice Selection guide](/guides/voice-selection) explains that the second argument to `speak()` accepts three shapes — `string`, `RegExp`, or `VoiceQuery`. The advantage of each isn't obvious from prose alone; this example makes it tangible by letting you express the same intent ("an English female voice") three different ways and watch the call site change.

## What you'll see

- **By Name** is a filterable list. Pick a row, hit Speak, and the call is `responsiveVoice.speak(text, "Voice Name")` — the exact name you clicked.
- **By Pattern** lets you type a regular expression. The example shows every voice whose name matches and highlights the first one — that's the voice the engine will use, since the resolver picks the first match.
- **By Query** is a structured filter. Set `lang`, `gender`, `provider`, or `isByok` and only voices matching every field you set will play. `lang` is a BCP-47 prefix match, so `en` matches `en-GB`, `en-US`, and so on. This same JSON-serializable shape is what the Python, Go, PHP, and Java SDKs send to the API.
- **`provider` and `isByok: true` both find premium voices.** Premium voices are voices that play through BYOK (bring-your-own-keys) services like Google Cloud WaveNet, Microsoft Azure Speech, or OpenAI TTS, using API keys you supply. The standard (free) tier has no provider value, so neither field will match a free voice.
- **`mul` is the language code for multilingual voices.** OpenAI TTS voices speak many languages and use `mul` instead of a specific code like `en-GB`. The language dropdown displays this entry as `mul (multilingual)` so it's recognizable, but the value passed to `speak()` is still the literal `"mul"`.
- **Bad regex patterns are caught immediately.** If you type an invalid pattern, the example shows the syntax error and disables Speak until you fix it.

## Next Steps

- [Voice Selection Guide](/guides/voice-selection) — the full reference for each selector form
- [Voice Resolver Hook](/guides/voice-resolver) — intercept and transform selectors before resolution
- [Extended Example](/examples/extended) — voice selection alongside speech parameter controls
