@capgo/capacitor-speech-synthesis
Overview
Section titled “Overview”@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.
Platform support
Section titled “Platform support”| Platform | Support | Notes |
|---|---|---|
| iOS | Yes | AVSpeechSynthesizer, audio session helpers |
| Android | Yes | Android TTS engine |
| Web | Partial | Browser speech synthesis where available |
Core Capabilities
Section titled “Core Capabilities”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.
Public API
Section titled “Public API”| Method | Description |
|---|---|
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. |
resume | Resumes paused speech. |
isSpeaking | Checks if speech synthesis is currently speaking. |
isAvailable | Checks if speech synthesis is available on the device. |
getVoices | Gets all available voices. |
getLanguages | Gets all available languages. |
isLanguageAvailable | Checks if a specific language is available. |
isVoiceAvailable | Checks if a specific voice is available. |
initialize | Initializes the speech synthesis engine (iOS optimization). This can reduce latency for the first speech request. |
activateAudioSession | Activates the audio session with a specific category (iOS only). |
deactivateAudioSession | Deactivates the audio session (iOS only). |
getPluginVersion | Gets the native plugin version. |
addListener | Listens for when an utterance starts speaking. |
addListener | Listens for when an utterance finishes speaking. |
addListener | Listens for word boundaries during speech. |
addListener | Listens for synthesis errors. |
removeAllListeners | Removes all event listeners. |
Source Of Truth
Section titled “Source Of Truth”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.