B4A Library ICOSTextToSpeech v1.4 with some news!!!

ICOSTextToSpeech v1.70 with some news!!!

Hello to everybody. ICOSTextToSpeech comes with two new additions.


ReadAndSpeakSMS -- It was totally changed.


ChangeDefaultLanguage -- is new, you can change the default language of your phone, with one chosen by you.

GoLanguageSettings -- open language setting to see if the language you have chosen is changed.


Please take a look to the Attached Images.


G.Salvi
 

Attachments

  • shot1.png
    shot1.png
    39.1 KB · Views: 495
  • shot2.png
    shot2.png
    84.2 KB · Views: 439
  • shot3.png
    shot3.png
    47.8 KB · Views: 392
  • shot4.png
    shot4.png
    34.6 KB · Views: 401
  • shot5.png
    shot5.png
    44.3 KB · Views: 388
  • shot6.png
    shot6.png
    36.1 KB · Views: 374
  • ICOSTextToSpeech v1.60.zip
    53 KB · Views: 308
  • ICOSTextToSpeech v1.70.zip
    48.1 KB · Views: 519
Last edited:

lonleystar

Well-Known Member
Licensed User
Longtime User
Could you please add playsilence as well?

TextToSpeech | Android Developers
hi inman, i just add PlaySilence.

this is an examples:

Button1_Click

tts.Speaking(a)
tts.PlaySilence(1000)
tts.Speaking(b)
tts.PlaySilence(3000)
tts.Speaking(c)

etc, etc

End Sub


download again the library and let me know.

best regards

G.Salvi
 

Inman

Well-Known Member
Licensed User
Longtime User
Sorry I don't understand how to use this library. Does it have a Ready (Success as Boolean) event to know if the engine is ready? Can you post an example from initialise to the speak command?
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Sorry I don't understand how to use this library. Does it have a Ready (Success as Boolean) event to know if the engine is ready? Can you post an example from initialise to the speak command?
Hi Inman download again the library.

This is the way to use it before I made a mistake but anyway inside is also the demo

Sub Button1_Click

tts.Speaking(a)

tts.PlaySilence(1000)

tts.AddSpeaking(b)

tts.PlaySilence(3000)

tts.AddSpeaking(a)

End Sub

***********************************************************

Sub tts_Ready (Success As Boolean)

If Success Then

ToastMessageShow("TTS is Ready",True)

Else

ToastMessageShow("TTS is not Ready",True)

End If

End Sub


best regards

G.Salvi
 

Inman

Well-Known Member
Licensed User
Longtime User
Thank you. While the engine is talking now, I can't change the engine with SetEngineByPackageName. Whichever package I set, when I call GetEngineByPackageName it still returns the default engine I set in the Settings. Can you check?

EDIT:

It works. You need to set it in the tts_Ready event. Also for some reason GetEngineByPackageName always returns the name of the default engine.
 
Last edited:

lonleystar

Well-Known Member
Licensed User
Longtime User
Thank you. While the engine is talking now, I can't change the engine with SetEngineByPackageName. Whichever package I set, when I call GetEngineByPackageName it still returns the default engine I set in the Settings. Can you check?

EDIT:

It works. You need to set it in the tts_Ready event. Also for some reason GetEngineByPackageName always returns the name of the default engine.
Hi Inman, You should first install other packages and then set it.

Try to instal IVONA tts from market is the best one.

best regard

g.salvi
 

Inman

Well-Known Member
Licensed User
Longtime User
Everything is working fine now.

Could you please add the isSpeaking() method too? I want to show a notification when the app is speaking and clear the notification when it is done speaking.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Everything is working fine now.

Could you please add the isSpeaking() method too? I want to show a notification when the app is speaking and clear the notification when it is done speaking.
Hi Inman sorry if i could not answare u fast.

IsSpeacking is Add.


Download again the library and letm me know.

Enjoy


best regards

G.Salvi
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
this adds a ridiculous amount of permissions. Can you make a version without the SMS/android.permission.ACCESS_LOCATION_EXTRA_COMMANDS/jp.co.c_lis.permission.CHANGE_LOCALE stuff?

my users wont accept this.
 

lindomar

Member
Licensed User
Longtime User
How to choose a real-time voice?
For example.
TTS locale (Settings> Language and input> Text-to-speech output> Settings button> Language)
 

lonleystar

Well-Known Member
Licensed User
Longtime User
How to choose a real-time voice?
For example.
TTS locale (Settings> Language and input> Text-to-speech output> Settings button> Language)
hi lindomar, sorry if i dont answare fast, why im studing Deutsch.

What u mean how to choose a real-time voice?

If u mean to change to engine u dont need to change from setting, set it from library.

Example:
tts.SetEngineByPackageName("com.google.android.tts")

let me know more.
 

NeoTechni

Well-Known Member
Licensed User
Longtime User
I'm having some trouble. Sometimes it'll speak, other times it won't and won't give me an error message.

Activity com.omnicorp.lcarui.dialer.main has leaked ServiceConnection android.speech.tts.TextToSpeech$1@2b0b37b0 that was originally bound here
android.app.ServiceConnectionLeaked: Activity com.omnicorp.lcarui.dialer.main has leaked ServiceConnection android.speech.tts.TextToSpeech$1@2b0b37b0 that was originally bound here
at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:938)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:833)
at android.app.ContextImpl.bindService(ContextImpl.java:871)
at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
at android.speech.tts.TextToSpeech.initTts(TextToSpeech.java:467)
at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:433)
at com.giuseppe.salvi.icos.library.TextToSpeech.TTs.InitializeTTs(TTs.java:118)
at com.omnicorp.lcarui.dialer.main._inittts(main.java:2979)
at com.omnicorp.lcarui.dialer.main._activity_resume(main.java:824)

B4X:
Sub InitTTS(State As Boolean)
    Log("INITTTS: " & State)
    If State Then
        If Not( TTS1.IsInitialized) OR Not(TTSisReady) Then TTS1.InitializeTTs("TTS1","en")' TTS1.Initialize("TTS1")
    Else If TTS1.IsInitialized Then
            TTS1.ShutDown
            'TTS1.Release
            TTSisReady=False
    End If
End Sub

Sub Speak(Text As String)
    Dim Error As Boolean
    If TTS1.IsInitialized  Then
        Try
            Log(SpeakName & " Say: " & Text)
            If SpeakName Then
                LCAR.Stop
                TTS1.StopToSpeak
                TTS1.Speaking(Text)
            End If
        Catch
            Error=True
        End Try
    Else
        Error=True
    End If
    If Error Then
        Log("ERROR")
        SpeakText=Text
        InitTTS(True)
    End If
End Sub
Sub StopSpeaking(Delay As Int)
    If TTS1.IsInitialized Then
        If Delay=0 Then
            TTS1.StopToSpeak
        Else
            TTS1.PlaySilence(Delay)
        End If
    End If
End Sub

Sub TTS1_Ready (Success As Boolean)
    TTSisReady=Success
    If Success AND SpeakText.Length>0 Then Speak(SpeakText)
    Log("TTS " & API.IIF(Success, "IS", "IS NOT") & " READY (" & SpeakText & ")")
    SpeakText=""
End Sub
 

RichyK68

Active Member
Licensed User
Longtime User
How can you tell if it is speaking or not? What is the name of the boolean property? I am using version 1.60

Richard

-It handles longer text
-You can check if it is speaking or not
-You can interrupt it without shutting it down
-you can add pauses.
 
Top