Android Question Strange pause after changing language and bevor speaking with tts

rboeck

Well-Known Member
Licensed User
Longtime User
Currently i am working on an translate app; i have a strange phenomen: especially after switching to french i have to wait 10 to 15 seconds after execution of the speak command. Then i get the text spoken. I cant imagine what happens in this time.
When i retry, it is speaking immediatly. I get the effect with internal tts, but also with tts id library.
There is something running behaind a curtain, that i dont unterstand. My question: Is there anybody with hints in the right direction?
 
Last edited:

rboeck

Well-Known Member
Licensed User
Longtime User
Currently i always use the internal google speech engine; the TTS engine is started from a starter service module. Yesterday i removed the libray tts id and switched back to the standard tts system and i saw, that some timing problems are gone.

When the user is choosing a new language i switch
with code like this:
B4X:
If Starter.Speaker.SetLanguage(Ln1,Ln2)=False  Then
            Sleep(100)
            Ok=False
      
            For i1= 1 To 3   'try three more times
                Ok= Starter.Speaker.SetLanguage(Ln1,Ln2)
                Sleep(200)
                          
                If Ok =False Then
                    Log("problems setting the language: " & i1)
                Else
                    SpeachEnabled=True
                    Exit
                End If
            Next
end if

Starter.Speaker.Speak("",True) 'new - does not speak, but pausing is now over!

As you can see, i do four attempts to get the languages switched.
So i use the boolean return value from Setlanguage to check, if the correct language is working.
Currently i fight with this problem:
~ 3% of the selectet language is incorrect, so a german speaker gets french language an so on. Maybe i can check with the java object, which language is currently set for speaking?
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
I get on object, type etc. back and i in the log window:
B4X:
lang
baselocale
[-hash      0
[-language   eng
but i dont know how exactly to read this?
 
Upvote 0
Top