Tts

splatt

Active Member
Licensed User
Is there a way to detect that the Speech has finished?

I want to disable a button untill a line of text has been spoken.
 

Rusty

Well-Known Member
Licensed User
Hi Erel,
It's been a while since I posted to this thread.
You offered to help with the ispeaking example.
Can you do so now?
I need to know when a TTS is finished speaking (or know when it is speaking).
thanks in advance.
 

RichyK68

Active Member
Licensed User
Wow, this is an old thread!
Sadly, the TextToSpeechFinish event is unreliable on the Samsung Galaxy S4 (it is raised twice) and it is raised immediately upon starting speaking the text on my Nexus 7 (which is stock Android, I believe). I'm still struggling to find a suitable solution for all devices. How would I go about using the IsSpeaking property with reflection? I'm hoping that might be the answer. Else it's pretty pointless combining TTS with VR on an Android device, using the built-in functionality.

Thanks,

Richard
 

RichyK68

Active Member
Licensed User
You're a legend, Erel! It actually appears to be working on both of my devices, I'll roll this new version out to others and see what the verdict is.

Thank you very much!!
 
U

unba1300

Guest
I just tried the code above and get the error:
java.lang.RuntimeException: Method: isSpeaking not found in: java.lang.String
And I am using the Reflection library.
 
U

unba1300

Guest
Sorry Erel, I am using both libraries Reflection and JavaObject, but still getting the same error. I've tried
Dim jTTS As JavaObject = TTS in both Process_Globals and Globals and
Log(jTTS.RunMethod("isSpeaking", null) in a part of my code after TTS1.Speak(lblStory.Text, True), which does speak the text. Could there be a conflict while using both libraries? I started using JavaObject to pad edittexts, and I'm using Reflection for various other things.
 

Douglas Farias

Expert
Licensed User
and how to make disable button spk when isSpeaking?
can post a simple code?

for exemple
button spk click
button spk.enable = false
TTS1.ready

if click again when isSpeaking show a mensage
"lalalalalalalala"

later finish speak button spk.enable = true ?????


sory my english.
i m not programmer xD
 

Douglas Farias

Expert
Licensed User
why this error :( ????

i m using this libs
-core
-java object

-dialogs
-clipboard
-TTS
-Admob
-Reflection
-Phone


java.lang.RuntimeException: Method: IsSpeaking not found in: android.speech.tts.TextToSpeech

my code

B4X:
Sub btnSpeak_Click
    Dim jTTS As JavaObject = TTS1
    If jTTS.RunMethod("IsSpeaking", Null) = True Then  'this line is the error *-*
    ToastMessageShow("Leitor em uso, aguarde!", True)
    Else If  EditText1.Text = "" Then
    ToastMessageShow("O campo texto está vazio",True)
    Else
    EditText1.SelectAll
    TTS1.Speak(EditText1.Text, True) 
    End If
End Sub
 
Top