utterance-progress-listener

Implements UtteranceProgressListener callbacks for Android TextToSpeech utterance tracking in Kotlin.

Updated May 9, 2026
One-click install
npx skills add https://github.com/Bumh3rr/solvyx-app --skill utterance-progress-listener-bumh3rr
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: utterance-progress-listener
Source: https://github.com/Bumh3rr/solvyx-app/tree/main/.opencode/skill/utterance-progress-listener
Command: npx skills add https://github.com/Bumh3rr/solvyx-app --skill utterance-progress-listener-bumh3rr

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Coordinating Android TextToSpeech playback is error-prone: callbacks arrive on background threads, utteranceIds get lost, and onDone may never fire after cancellation. This Skill provides tested patterns for wiring UtteranceProgressListener so you can reliably react when speech starts, finishes, or fails. ## Core Features & Use Cases - Typed per-utterance callbacks: Correlate onStart, onDone, and onError with specific speak() calls using unique utteranceIds and a callback map. - Coroutine and Flow integration: Wrap speech in suspendCancellableCoroutine for sequential speak-and-await flows, or expose events via SharedFlow for Compose/ViewModel state updates. - Error handling and cancellation: Map TTS error codes to readable messages, cancel individual utterances on API 33+, and clean up listeners to avoid memory leaks. - Use Case: Build a guided breathing exercise app where the engine speaks "inhale 4 counts", waits for completion, delays, then speaks the next phase, all sequenced with coroutines. ## Quick Start Ask the AI to implement an Android TTS engine with UtteranceProgressListener that exposes typed onStart, onDone, and onError callbacks per utteranceId and supports a suspend speakAndAwait function.

Frequently Asked Questions about utterance-progress-listener

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use UtteranceProgressListener with Android TextToSpeech?▼

Call setOnUtteranceProgressListener on your TextToSpeech instance and override onStart, onDone, and onError. Pass a unique utteranceId to each speak() call so callbacks can be correlated with specific utterances.

How to wait for Android TTS to finish speaking in Kotlin coroutines?▼

Wrap speak() in suspendCancellableCoroutine and resume the continuation from the onDone and onError callbacks. Register invokeOnCancellation to call stop() so cancellation interrupts playback.

Why are UtteranceProgressListener callbacks not called on the main thread?▼

The TTS engine invokes listener callbacks on its own background thread, not the main thread. Post UI updates through Handler(Looper.getMainLooper()) or launch them on a Main-dispatcher coroutine scope.

Why is onDone not called after stopping Android TTS?▼

Calling stop() cancels pending utterances, and onDone is not delivered for cancelled speech. This is expected behavior, so clean up pending callbacks manually when stopping all utterances.

Can I cancel a specific TTS utterance by utteranceId on Android?▼

On Android 13 (API 33) and above, use stopUtterance(utteranceId) to cancel one utterance. On earlier versions no per-utterance API exists, so the workaround is calling stop() and re-queuing remaining speech.