Android Question (SOLVED) Problem of coexistence between TTS and STT

Paolo Pini

Member
Licensed User
Longtime User
Hi all,

i have a problem with TTS and STT library 'cause I have an app that hear vocal commands, execute the command and repeat the command received via TTS.
At this time STT hear herself speak from loudspeaker and repeat newly the same command in loop.

One solution is to alterate the repeated command so this is not in the list of command enabled and so is not recognized but sometimes I need
to repeat the precise command speak and in this mode is impossible, moreover app waste time to lookup useless commands.

I could try to disable the STT until the speak is running but I don't know how to trace the TTS status.

There are trick to mute microphone until command spoken is completed? or other suggestions?

Thanks and Regards

Paolo
 

klaus

Expert
Licensed User
Longtime User
I could try to disable the STT until the speak is running but I don't know how to trace the TTS status.
I do it with this code:
B4X:
Private jTTS As JavaObject
TTS1.Speak(Text, True)
Do While jTTS.RunMethod("isSpeaking", Null) = True
Loop
 
Upvote 0

Paolo Pini

Member
Licensed User
Longtime User
This works for me,

thank you.

B4X:
            TTS1.Speak(partialResultBox.Text, True)
            
            Dim jo As JavaObject = TTS1
            Do While jo.RunMethod("isSpeaking",Null) = True
                Sleep(100)
            Loop
            Log("done speaking")
            
            STT.reset  '<--- necessary because stt anyway queues what he listens to during the speaking.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…