0

Suppose I have activity on which there is a list of 10 items. Each element is a text in some language. Suppose each language has a voice output. If I want to make a button, by clicking on which all texts will be read in their own language, I need to change the language before I start reading each text. The problem is that changing the language takes a lot of time (from 2-3 seconds to 5-7) on some phones that I checked. I saw the application where it happens instantly. How can I implement this without creating another object for each language?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

0

Different phones have different speech engines installed on them (Google, Samsung, PICO, etc)...

The delay is going to vary slightly based on which engine is being used... and a lot based on:

1) Whether any voices are previously installed that correspond to the language you're attempting to speak,

2) Whether the voice being used to speak is a "network voice" (utterance is retrieved via network)

So to get zero delay, the voices must be installed and they must not be network voices.

Nerdy Bunz
  • 6,040
  • 10
  • 41
  • 100
  • I just tried with English and with Russian without internet. Both are installed on the phone. Despite this, when changing the language there is a delay of a couple of seconds. – Vlad Adrian Dec 19 '18 at 11:19
  • It's probably the Google engine and it's checking for internet each time... or who knows what it's doing. The only sure way to have 100% control over it is to use an embedded engine that is contained in your actual app code and doesn't use the TTS that exists on the phone. That is rather advanced and I don't know how to do it. But if you'd like to learn more about TTS... at least what I know about it, you can try the testing app I made here: https://stackoverflow.com/questions/51510129/android-text-to-speech-api-sounds-robotic/51528735#51528735 – Nerdy Bunz Dec 19 '18 at 11:30