Very slow english reading on some real device. Big delay before reading and breaking all reading
🐛 Bug Report
I use flutter_tts 3.7.0
My app has different groups of sentences on different languages. Its scroll with 10 seconds delay. When you see sentence 1, my app read that text. And so on.
On Android and iOS emulator all works fine. I didn't see any problems. But I started to test it on 3 real device:
- Samsung S10+ — works fine
- iPhone X
- Samsung S7
On iPhone X and Samsung S7 I saw common problem. Group sentences on English language was very slow. App reads it with enough long delay. And when I see the 10th sentence I hear text only the 3rd sentence.
In other languages I didn't see this problem. When I tried to create another group of sentence again in English I had the same problem. But when I reinstall again my app on that devices I didn't have such problem.
I understand that almost all people who will be use my app, can have the same problem on the most popular language. As I understand, problem can be through cache after first starting. But how can I decide it, that I will not have this problem on user devices?
Maybe somebody can help me find any decision? As I see, in the first time, when I use tts, system download packages which are needed for this. And, as I see, in this moment can occur some incorrect downloading for that language which using right now. I think so because in the first time tts read text like robot with sound errors.
- Can I start loading languages in background mode?
- Can I know when loading is finished?
- Maybe have you any ideas?
As I see, problem concern of the first language. If I will set german language as the first in using, I will receive the same breaking only with it. Therefore I think that it's problem of caching tts files in system.
Help me, please.
I cleaned all my cached, deleted and reinstall my app. Also I created additional method for initializing TTS:
Future
I run it and receive something else. On my Samsung S7 problem was only with English language. Delay before reading disappeared but I start to feel Russian accent in reading. Than I did it:
print('>>> defaultEngint: $defaultEngint');
print('>>> defaultVoice: $defaultVoice');
print('>>> voices: $voices');
print('>>> engines: $engines');
print('>>> speechRateValidRange: $speechRateValidRange');
print('>>> maxSpeechInputLength: $maxSpeechInputLength');
And I received this:
defaultEngint: com.samsung.SMT defaultVoice: {name: ru-RU-language, locale: ru-RU} voices: [{name: ur-PK-language, locale: ur-PK}, {name: ja-jp-x-htm-network, locale: ja-JP}, {name: kn-in-x-knm-network, locale: kn-IN}, {name: nl-nl-x-yfr-network, locale: nl-NL}, {name: it-it-x-itd-local, locale: it-IT}, {name: en-AU-language, locale: en-AU}, {name: ta-in-x-taf-network, locale: ta-IN}, {name: vi-vn-x-vif-network, locale: vi-VN}, {name: uk-UA-language, locale: uk-UA}, {name: sv-se-x-lfs-local, locale: sv-SE}, {name: cmn-tw-x-ctc-network, locale: zh-TW}, {name: en-us-x-tpf-local, locale: en-US}, {name: de-de-x-deb-network, locale: de-DE}, {name: yue-hk-x-yuf-network, locale: yue-HK}, {name: en-in-x-end-network, locale: en-IN}, {name: nl-nl-x-yfr-local, locale: nl-NL}, {name: pl-pl-x-afb-local, locale: pl-PL}, {name: fr-ca-x-cab-local, locale: fr-CA}, {name: ru-ru-x-rud-network, locale: ru-RU}, {name: da-dk-x-sfp-network, locale: da-DK}, {name: ru-ru-x-ruf-local, locale: ru-RU}, {name: bn-BD-language, locale: bn-BD}, {name: te-in-x-tem-network, locale: te-IN},
engines: [com.samsung.SMT, com.google.android.tts] speechRateValidRange: Instance of 'SpeechRateValidRange' maxSpeechInputLength: 4000
And I see, now system doesn't find english in my phone. Why? What can I do that it start to work properly? Can I set up another engine in Samsung or iPhone? How?
Maybe I'm not right, but, as I see, some devices have own tts engine with its own name of voice. As I see here {name: en-us-x-tpf-local, locale: en-US} my Samsung can have untypical name of voice. When I use this await flutterTts.setVoice({"name": "en-us-x-tpf-local", "locale": "en-US"}); it works on my Samsung.
You can run setEngine on Android, however iOS uses their own native engine. As for any delays with downloading languages, I'll need to look into that and see if we can hook into its progress.
An option for right now is to call isLanguageInstalled until the language you desire is installed on the user's device.