Skip to content

@capgo/capacitor-speech-synthesis

Speak text aloud or export speech to a file with voice, rate, pitch, and language controls.

@capgo/capacitor-speech-synthesis drives the platform text to speech engine for accessibility, language learning, and hands free navigation. Pick a voice, tune rate and pitch, pause or resume long passages, and render audio files on iOS and Android for offline playback.

Call initialize() on iOS for faster first speak, and activateAudioSession() when you need a specific iOS audio category.

PlatformSupportNotes
iOSYesAVSpeechSynthesizer, audio session helpers
AndroidYesAndroid TTS engine
WebPartialBrowser speech synthesis where available
  • speak - Speaks the given text with specified options. The utterance is added to the speech queue.
  • synthesizeToFile - Synthesizes speech to an audio file (Android/iOS only). Returns the file path where the audio was saved.
  • cancel - Cancels all queued utterances and stops current speech.
  • pause - Pauses speech immediately.
MethodDescription
speakSpeaks the given text with specified options. The utterance is added to the speech queue.
synthesizeToFileSynthesizes speech to an audio file (Android/iOS only). Returns the file path where the audio was saved.
cancelCancels all queued utterances and stops current speech.
pausePauses speech immediately.
resumeResumes paused speech.
isSpeakingChecks if speech synthesis is currently speaking.
isAvailableChecks if speech synthesis is available on the device.
getVoicesGets all available voices.
getLanguagesGets all available languages.
isLanguageAvailableChecks if a specific language is available.
isVoiceAvailableChecks if a specific voice is available.
initializeInitializes the speech synthesis engine (iOS optimization). This can reduce latency for the first speech request.
activateAudioSessionActivates the audio session with a specific category (iOS only).
deactivateAudioSessionDeactivates the audio session (iOS only).
getPluginVersionGets the native plugin version.
addListenerListens for when an utterance starts speaking.
addListenerListens for when an utterance finishes speaking.
addListenerListens for word boundaries during speech.
addListenerListens for synthesis errors.
removeAllListenersRemoves all event listeners.

This reference is synced from src/definitions.ts in capacitor-speech-synthesis.

Keep going from @capgo/capacitor-speech-synthesis

Section titled “Keep going from @capgo/capacitor-speech-synthesis”

If you are using @capgo/capacitor-speech-synthesis to plan native plugin work, connect it with Using @capgo/capacitor-speech-synthesis for the native capability in Using @capgo/capacitor-speech-synthesis, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins, and Ionic Enterprise Plugin Alternatives for the product workflow in Ionic Enterprise Plugin Alternatives.