@capgo/capacitor-speech-synthesis

June 16, 2026 ยท View on GitHub

Capgo - Instant updates for Capacitor

โžก๏ธ Get Instant updates for your App with Capgo

Missing a feature? We'll build the plugin for you ๐Ÿ’ช

Synthesize speech from text with full control over language, voice, pitch, rate, and volume.

Why Speech Synthesis?

A free, open-source alternative providing complete text-to-speech capabilities:

  • Cross-platform - Works on iOS, Android, and Web with consistent API
  • Full voice control - Choose from system voices, adjust pitch, rate, and volume
  • Event-driven - Listen to speech events (start, end, word boundaries, errors)
  • File export - Save speech to audio files on iOS and Android
  • Modern APIs - Uses AVSpeechSynthesizer (iOS), TextToSpeech (Android), and Web Speech API
  • Production-ready - Complete TypeScript support with comprehensive documentation

Perfect for accessibility features, language learning apps, audiobook players, and any app needing text-to-speech.

Compatibility

Plugin versionCapacitor compatibilityMaintained
v8.*.*v8.*.*โœ…
v7.*.*v7.*.*On demand
v6.*.*v6.*.*โŒ
v5.*.*v5.*.*โŒ

Note: The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.

Install

You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:

npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-speech-synthesis` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

npm install @capgo/capacitor-speech-synthesis
npx cap sync

API

Speech Synthesis Plugin for synthesizing speech from text.

speak(...)

speak(options: SpeakOptions) => Promise<SpeakResult>

Speaks the given text with specified options. The utterance is added to the speech queue.

ParamTypeDescription
optionsSpeakOptions- The speech options including text and voice settings

Returns: Promise<SpeakResult>

Since: 1.0.0


synthesizeToFile(...)

synthesizeToFile(options: SpeakOptions) => Promise<SynthesizeToFileResult>

Synthesizes speech to an audio file (Android/iOS only). Returns the file path where the audio was saved.

ParamTypeDescription
optionsSpeakOptions- The speech options including text and voice settings

Returns: Promise<SynthesizeToFileResult>

Since: 1.0.0


cancel()

cancel() => Promise<void>

Cancels all queued utterances and stops current speech.

Since: 1.0.0


pause()

pause() => Promise<void>

Pauses speech immediately.

Since: 1.0.0


resume()

resume() => Promise<void>

Resumes paused speech.

Since: 1.0.0


isSpeaking()

isSpeaking() => Promise<{ isSpeaking: boolean; }>

Checks if speech synthesis is currently speaking.

Returns: Promise<{ isSpeaking: boolean; }>

Since: 1.0.0


isAvailable()

isAvailable() => Promise<{ isAvailable: boolean; }>

Checks if speech synthesis is available on the device.

Returns: Promise<{ isAvailable: boolean; }>

Since: 1.0.0


getVoices()

getVoices() => Promise<{ voices: VoiceInfo[]; }>

Gets all available voices.

Returns: Promise<{ voices: VoiceInfo[]; }>

Since: 1.0.0


getLanguages()

getLanguages() => Promise<{ languages: string[]; }>

Gets all available languages.

Returns: Promise<{ languages: string[]; }>

Since: 1.0.0


isLanguageAvailable(...)

isLanguageAvailable(options: IsLanguageAvailableOptions) => Promise<{ isAvailable: boolean; }>

Checks if a specific language is available.

ParamTypeDescription
optionsIsLanguageAvailableOptions- The language to check

Returns: Promise<{ isAvailable: boolean; }>

Since: 1.0.0


isVoiceAvailable(...)

isVoiceAvailable(options: IsVoiceAvailableOptions) => Promise<{ isAvailable: boolean; }>

Checks if a specific voice is available.

ParamTypeDescription
optionsIsVoiceAvailableOptions- The voice ID to check

Returns: Promise<{ isAvailable: boolean; }>

Since: 1.0.0


initialize()

initialize() => Promise<void>

Initializes the speech synthesis engine (iOS optimization). This can reduce latency for the first speech request.

Since: 1.0.0


activateAudioSession(...)

activateAudioSession(options: ActivateAudioSessionOptions) => Promise<void>

Activates the audio session with a specific category (iOS only).

ParamTypeDescription
optionsActivateAudioSessionOptions- The audio session category

Since: 1.0.0


deactivateAudioSession()

deactivateAudioSession() => Promise<void>

Deactivates the audio session (iOS only).

Since: 1.0.0


getPluginVersion()

getPluginVersion() => Promise<{ version: string; }>

Gets the native plugin version.

Returns: Promise<{ version: string; }>

Since: 1.0.0


addListener('start', ...)

addListener(eventName: 'start', listenerFunc: (event: UtteranceEvent) => void) => Promise<PluginListenerHandle>

Listens for when an utterance starts speaking.

ParamTypeDescription
eventName'start'- The event name ('start')
listenerFunc(event: UtteranceEvent) => void- The callback function

Returns: Promise<PluginListenerHandle>

Since: 1.0.0


addListener('end', ...)

addListener(eventName: 'end', listenerFunc: (event: UtteranceEvent) => void) => Promise<PluginListenerHandle>

Listens for when an utterance finishes speaking.

ParamTypeDescription
eventName'end'- The event name ('end')
listenerFunc(event: UtteranceEvent) => void- The callback function

Returns: Promise<PluginListenerHandle>

Since: 1.0.0


addListener('boundary', ...)

addListener(eventName: 'boundary', listenerFunc: (event: BoundaryEvent) => void) => Promise<PluginListenerHandle>

Listens for word boundaries during speech.

ParamTypeDescription
eventName'boundary'- The event name ('boundary')
listenerFunc(event: BoundaryEvent) => void- The callback function

Returns: Promise<PluginListenerHandle>

Since: 1.0.0


addListener('error', ...)

addListener(eventName: 'error', listenerFunc: (event: ErrorEvent) => void) => Promise<PluginListenerHandle>

Listens for synthesis errors.

ParamTypeDescription
eventName'error'- The event name ('error')
listenerFunc(event: ErrorEvent) => void- The callback function

Returns: Promise<PluginListenerHandle>

Since: 1.0.0


removeAllListeners()

removeAllListeners() => Promise<void>

Removes all event listeners.

Since: 1.0.0


Interfaces

SpeakResult

Result from speaking text.

PropTypeDescriptionSince
utteranceIdstringUnique identifier for this utterance.1.0.0

SpeakOptions

Options for speaking text.

PropTypeDescriptionSince
textstringThe text to speak.1.0.0
languagestringThe BCP-47 language tag (e.g., 'en-US', 'es-ES').1.0.0
voiceIdstringThe voice identifier to use.1.0.0
pitchnumberThe pitch of the voice (0.5 to 2.0, default: 1.0).1.0.0
ratenumberThe speaking rate (0.1 to 10.0, default: 1.0).1.0.0
volumenumberThe volume (0.0 to 1.0, default: 1.0).1.0.0
queueStrategy'Add' | 'Flush'The queue strategy: 'Add' to append or 'Flush' to replace queue. Default: 'Add'1.0.0

SynthesizeToFileResult

Result from synthesizing to file.

PropTypeDescriptionSince
filePathstringThe file path where audio was saved.1.0.0
utteranceIdstringUnique identifier for this utterance.1.0.0

VoiceInfo

Information about a voice.

PropTypeDescriptionSince
idstringUnique voice identifier.1.0.0
namestringDisplay name of the voice.1.0.0
languagestringBCP-47 language code.1.0.0
gender'male' | 'female' | 'neutral'Gender of the voice (iOS only).1.0.0
isNetworkConnectionRequiredbooleanWhether this voice requires a network connection.1.0.0
defaultbooleanWhether this is the default voice (Web only).1.0.0

IsLanguageAvailableOptions

Options for checking language availability.

PropTypeDescriptionSince
languagestringThe BCP-47 language code to check.1.0.0

IsVoiceAvailableOptions

Options for checking voice availability.

PropTypeDescriptionSince
voiceIdstringThe voice ID to check.1.0.0

ActivateAudioSessionOptions

Options for activating the audio session (iOS only).

PropTypeDescriptionSince
category'Ambient' | 'Playback'The audio session category. - 'Ambient': Mixes with other audio - 'Playback': Stops other audio1.0.0

PluginListenerHandle

PropType
remove() => Promise<void>

UtteranceEvent

Event emitted when utterance starts or ends.

PropTypeDescriptionSince
utteranceIdstringThe utterance identifier.1.0.0

BoundaryEvent

Event emitted at word boundaries.

PropTypeDescriptionSince
utteranceIdstringThe utterance identifier.1.0.0
charIndexnumberThe character index in the text.1.0.0
charLengthnumberThe character length of the current word.1.0.0

ErrorEvent

Event emitted on synthesis error.

PropTypeDescriptionSince
utteranceIdstringThe utterance identifier.1.0.0
errorstringThe error message.1.0.0