Better French Tts
High-level French TTS wrapper around Android's native TextToSpeech.
Automatically selects the best offline French voice, generates SSML behind the scenes, and exposes a Kotlin DSL for fine-grained speech control.
Quick start
val tts = BetterFrenchTts(context, BetterFrenchTts.Config(
onReady = { it.speak("Bonjour le monde !") }
))DSL usage
tts.speak {
text("Bonjour.")
pause(500)
slow { text("Ceci est important.") }
}Coroutine usage
lifecycleScope.launch {
val result = tts.speakAndAwait("Bonjour le monde !")
}Parameters
Android context (application context is used internally to avoid leaks).
Optional Config to customize voice selection, presets, and callbacks.
See also
Types
Strategy for managing audio focus while speaking.
Configuration for BetterFrenchTts.
Properties
Zero-based index of the item currently being spoken, or -1 if no queue is active.
The currently active Voice, or null if the engine is not yet ready or no voice was found.
true once the TTS engine has been initialized and a French voice has been selected.
true if a queue is active but paused.
true if a queue is currently playing (not paused).
true if the TTS engine is currently speaking an utterance.
Functions
Adds a pronunciation rule to the dictionary.
Returns the SSML that would be generated by the DSL block, without speaking it.
Removes all entries from the pronunciation dictionary.
Clears the speech queue and stops any ongoing playback.
Adds a DSL-built speech item to the queue.
Adds a text item to the speech queue.
Adds multiple text items to the queue at once, all sharing the same preset.
Returns all available offline French voices on this device, sorted by quality (descending).
Registers a callback invoked on the main thread when an utterance finishes successfully.
Registers a callback invoked on the main thread when an utterance fails.
Registers a callback invoked on the main thread when all queue items have been spoken.
Registers a callback invoked on the main thread each time a new queue item starts playing.
Registers a callback invoked on the main thread when an utterance starts playing.
Registers a callback invoked on the main thread each time the TTS engine starts speaking a new word or text range.
Pauses the speech queue.
Starts playing the speech queue from the beginning.
Removes a word from the pronunciation dictionary.
Resumes a paused speech queue.
Skips to the next item in the queue.
Speaks content built with the Kotlin DSL.
Suspends until the TTS engine finishes speaking the DSL content.
Suspends until the TTS engine finishes speaking text.
Speaks raw SSML directly, bypassing the DSL and preset system.
Speaks DSL content wrapped in the given preset prosody.