TTS Ready Event

CarlM

Member
Licensed User
Longtime User
Hi.

I am trying to write an app that is entirely handsfree - using the TTS and VR libraries.
It seems that you have to wait for the TTS Ready event to fire each time the Speak method is called before the the TTS can be used again. Originally I thought this event only fired during initilialisation.. ..is it self re-initilaising after every call to Speak I wonder?
As the Ready event is 'asyncronously' happening it means a lot of code has to go in the (TTS) Ready event and it can be any number of seconds before it becomes Ready again after each Speak() call.
In order to try and control the firing of this event somewhat I have been using Release and Initilialize before each Speak call and then wait for Ready to fire and handle the Speech there -(which is probably not good on resources?)

My question then is:
Has anyone figured a way to test for the 'Ready' state instead of waiting for it to occur?

Thanks,
 

CarlM

Member
Licensed User
Longtime User
TTS Ready

OK Thanks Erel.

I have to scrap this project now as I just found out you can't use the VR without a valid internet connection!
 
Upvote 0

Askjerry

Member
Licensed User
Longtime User
Tts - How To Basic - Speech - Talk

There is going to be some NOOB out there asking how to use the TTS... so I'll post this. All you experts can tell me what I did wrong... but hey... it works!

1) Button1 starts it talking
2) Button2 exits the application
3) EditText1 is where you enter text

Here is the code...

B4X:
'Activity module
Sub Process_Globals
   Dim yack As TTS
End Sub

Sub Globals
   Dim Button1 As Button
   Dim Button2 As Button
   Dim EditText1 As EditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("MAIN")
   yack.Initialize(TTS_START)
End Sub

Sub Button1_Click
   If yack.IsInitialized = True Then
   yack.Speak(EditText1.Text,True)
   End If
End Sub

Sub Button2_Click
   If yack.IsInitialized = True Then
   yack.Speak("Good bye. I hope I see you again.",True)
   End If
   Activity.Finish
End Sub

Sub TTS_START
   ' Just here
End Sub

If it saves you some time... then it was worth it!
Jerry
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…