Android Question Problem in TextToSpeechFinish

SMOOTSARA

Active Member
Licensed User
Longtime User
Hello friends:)

Today I realized that this section has a small problem:eek:
The problem is that if the language settings are in English, everything is fine, but if the language settings are in German, this section does not work well.

Notice the following code
When I use the following code, everything is fine
And when the message is finished, the message is displayed
((--Log("TextToSpeechFinish"--))

B4X:
Sub Label_tts_Click


  '''      Starter.tts.SetLanguage("de","DE")  ''' !!!!!!!!
        Starter.tts.SetLanguage("en","EN")   'everything is fine

        Starter.tts.Speak("A B C D E F G H I J K L M N O P",True)      
End Sub

Sub PhoneEvents2_TextToSpeechFinish (Intent As Intent)
  
           Log("TextToSpeechFinish")

            Label_tts.Text=Chr(0xE050)
            Label_tts.TextColor=CodeModule.color_darkwood
          
End Sub


If the program language is in German, when it starts speaking, the instant message will be displayed

B4X:
Sub Label_tts_Click


        Starter.tts.SetLanguage("de","DE")      ' !!!!!!!!
   ''     Starter.tts.SetLanguage("en","EN")   'everything is fine

       Starter.tts.Speak("A B C D E F G H I J K L M N O P",True)  
End Sub

Sub PhoneEvents2_TextToSpeechFinish (Intent As Intent)
  
           Log("TextToSpeechFinish")

            Label_tts.Text=Chr(0xE050)
            Label_tts.TextColor=CodeModule.color_darkwood
          
End Sub

--------------------------------------------------------

In fact, when an English text is spoken, it appears after the end of the pronunciation of the message:) Log("TextToSpeechFinish")
But
When a German text is pronounced, this message will be ignored 2 times.
Once in the beginning and again in the end of the pronunciation
Log("TextToSpeechFinish")
Log("TextToSpeechFinish")
.:eek::eek:

Please help me solve this problem
Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Try
de_DE
for the first and/or second value...
 
Upvote 0

SMOOTSARA

Active Member
Licensed User
Longtime User
Try the above suggestion.

HI Erel :)
I fixed this problem as follows CODE
But I think it's a bug in TTS library
I hope to be upgraded ;)

B4X:
Sub PhoneEvents2_TextToSpeechFinish (Intent As Intent)

Sleep(1000)
    If tts_is_Speaking Then
      
        LogColor("Still busy with pronunciation",Colors.Magenta)
  
    Else
    Log("TextToSpeechFinish")
  
            Label_tts_En_proverb.Text=Chr(0xE050)
            Label_tts_En_proverb.TextColor=CodeModule.color_darkwood
End If
End Sub





Sub tts_is_Speaking As Boolean
    Dim jTTS As JavaObject = Starter.tts
    If jTTS.RunMethod("isSpeaking", Null) = True Then
        Return True
    Else
        Return False
    End If
End Sub
 
Upvote 0
Top