Engines and voices
List voices and Android text-to-speech engines, switch engines, and install voice data.
Getting available voices
Retrieve a list of all available voices on the device. Optionally, you can filter voices by providing a language code or tag (IETF BCP 47 language tag).
Speech.getAvailableVoices(language?: string): Promise<VoiceProps[]>Each voice provides the following properties:
name: the name of the voice.identifier: the unique identifier for the voice.language: the language tag (e.g.,'en-US','fr-FR').quality: the quality level of the voice ('Default'or'Enhanced').
// Retrieve all voices
Speech.getAvailableVoices().then(voices => {
console.log('Available voices:', voices);
});
// Retrieve only English voices
Speech.getAvailableVoices('en').then(voices => {
console.log('English voices:', voices);
});
// Retrieve only English (US) voices
Speech.getAvailableVoices('en-US').then(voices => {
console.log('English (US) voices:', voices);
});Engine management (Android)
These methods are available only on Android and allow you to manage the underlying text-to-speech engine.
Get available engines
Gets a list of all available text-to-speech engines installed on the device.
Speech.getEngines(): Promise<EngineProps[]>Each engine provides the following properties:
name: the unique system identifier for the engine (e.g.,"com.google.android.tts").label: the human-readable display name (e.g.,"Google Text-to-Speech Engine").isDefault: a boolean flag indicating if this is the default engine.
Speech.getEngines().then(engines => {
engines.forEach(engine => {
console.log(`Engine: ${engine.label} (${engine.name})`);
if (engine.isDefault) {
console.log('This is the default engine.');
}
});
});Set speech engine
Sets the text-to-speech engine to use for all subsequent synthesis.
Speech.setEngine(engineName: string): Promise<void>// First, get available engines
const engines = await Speech.getEngines();
if (engines.length > 0) {
// Then set a specific engine by its name
await Speech.setEngine(engines[0].name);
}If the requested engine is not available on the device, the call is rejected with an engine_error — see Troubleshooting.
Open voice data installer
Opens the system activity that allows the user to install or manage TTS voice data.
Speech.openVoiceDataInstaller(): Promise<void>Speech.openVoiceDataInstaller().catch(error => {
console.error('Failed to open voice data installer.', error);
});The engine management methods and the voice data installer are Android platform features.