grammatek / simaromur

Icelandic TTS (text-to-speech) service for Android
Apache License 2.0
8 stars 2 forks source link

Fix/speechrate #162

Closed lumpidu closed 8 months ago

lumpidu commented 8 months ago

Fix speechrate sent via Talkback settings.

So far we derived the current speech rate from the Voice Settings dialog only and ignored any speech rate received via onSynthesizeText(). But when using Talkback, the TTS request itself contains a combined value of the voice speech-rate setting and the Talkback adapted multiplier.

To keep the previous behaviour consistent, we derive the current speed setting from the received speech-rate, adapt these settings again to our plausible values and then use the additional factor received from e.g. Talkback to derive the final speech rate.

Moreover fix rare crash seen in Google Crashlytics for getVoiceNativeSampleRate()

Don't call mRepository.getVoiceNativeSampleRate() in case loadVoice() is not successful. Just error out via callback.error() and don't call beforehand callback.start() as well.