ColibrioTtsSynthesizer

A TtsSynthesizer implementation based on the Android Text to speech API android.speech.tts.TextToSpeech.

To customize the language and voice used, see onBeforeSpeak.

Constructors

Link copied to clipboard

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun addUtterance(speechData: TtsUtteranceData)

Add the utterance to the queue of utterances to speak.

Link copied to clipboard
open override fun clearAndPause()

The implementation must stop any current playing utterance and set itself in paused state. It should then clear the queue of utterances to speak.

Link copied to clipboard
open override fun destroy()

Destroys this instance. The synthesizer will clear the utterance queue and set itself in paused state. The reference to any callbacks passed with init() is released.

Link copied to clipboard
open override fun init(callbacks: TtsSynthesizerCallbacks)

Called before any other method to register a callbacks instance used for reporting progress, etc.

Link copied to clipboard
open fun onAudioAvailable(p0: String, p1: ByteArray)
Link copied to clipboard
open fun onBeginSynthesis(p0: String, p1: Int, p2: Int, p3: Int)
Link copied to clipboard
open override fun onDone(utteranceId: String?)
Link copied to clipboard
open override fun onError(utteranceId: String?)
open override fun onError(utteranceId: String?, errorCode: Int)
Link copied to clipboard
open override fun onRangeStart(utteranceId: String?, start: Int, end: Int, frame: Int)
Link copied to clipboard
open override fun onStart(utteranceId: String?)
Link copied to clipboard
open override fun onStop(utteranceId: String?, interrupted: Boolean)
Link copied to clipboard
open override fun pause()

Will be called by the SyncMediaPlayer when it should pause playback.

Link copied to clipboard
open override fun play()

Resume the playback of the current active utterance if any exists, otherwise the next utterance from the utterance queue. The implementation must use callbacks.onUtteranceEnd() when each utterance has finished speaking.

Link copied to clipboard
open override fun setMuted(muted: Boolean)

Sets if playback should be muted. When called with false, the synthesizer should unmute and use the playback volume last set by setVolume.

Link copied to clipboard
open override fun setPlaybackRate(playbackRate: Double)

Will be called by the SyncMediaPlayer when its playbackRate has been changed.

Link copied to clipboard
open override fun setVolume(volume: Double)

Will be called by the SyncMediaPlayer when its volume has been changed.

Properties

Link copied to clipboard
Link copied to clipboard

Assign a function to this field to receive a callback before a text segment is passed to TextToSpeech.speak.

Extensions

Link copied to clipboard
fun <T> CoroutineScope.convertToCallbacks(block: suspend () -> ColibrioResult<T>, onSuccess: (T) -> Unit, onError: (ColibrioException) -> Unit)
fun <T> CoroutineScope.convertToCallbacks(block: suspend () -> ColibrioResult<T>, onSuccess: () -> Unit, onError: (ColibrioException) -> Unit)