Bug? TTS won't speech

nw11

Member
Licensed User
B4X:
Sub Process_Globals
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private Button1 As Button
    Dim TTS1 As TTS
    Dim List1 As List
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.LoadLayout("t1")
    Page1.RootPanel.Color = Colors.White
    NavControl.ShowPage(Page1)
    TTS1.Initialize("ttsEv")
    TTS1.Pitch = 0.5
    TTS1.SpeechRate = 0.5  
End Sub

Sub Button1_Click
    List1.Initialize
    List1 = TTS1.GetSupportedLanguages
    For j = 0 To List1.Size - 1
        If List1.Get(j) = "en-GB" Then
            If TTS1.SetLanguage(List1.Get(j)) Then
                TTS1.Speak("hi", True)
                Exit
            End If
            Exit
        End If
    Next
End Sub

Sub ttsEv_Complete (Text As String)
    Log("Text : " & Text)
End Sub

Complete event was fired and the log write 'Text : hi' but the text was not specheed.

What i'm wrong ?

or There's something i have to enable on the phone ?
 
Last edited:

nw11

Member
Licensed User
Thank your for your reply ..
i have tested the app with iphone 4S .. initially with 7.0.4 ios version and after with 8.1.1 vers.
siri speak very well and i can hear speak other similar translation app (like google tranls. or ihandy) i have downloaded from the app store.
what i have noted is that i can hear my app speak when i connect the headset so .. i think i can excluding it's a bug or something not working in your library. now i have to google navigate and try to understand if someone else have had the same problem.
if you tell me that it does work for you, i could submit the app to the App Store even if it does not work properly on my device.

thank you very much for your time.

F
 

rboeck

Well-Known Member
Licensed User
I tried the sample; i dont get any speaking; i used "de-DE" and "en-GB" for setlanguage. My current device: iPhone 4, iOS 7.1.2
I will try it now with an newer iPad and edit this message with the results.
 

Paul Leischow

Member
Licensed User
Same problem here, no audio from speakers of an iPhone 5C running iOS8.4.
If I plug in headphones there is audio.

Also tested on an old iPad running iOS7 and the audio works fine from the speakers.

Any ideas?
The problem posted here a year ago does not seem to be resolved.
 

Erel

Administrator
Staff member
Licensed User
Please try this code (on a real device):
B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'Public variables can be accessed from all modules.
   Public App As Application
   Public NavControl As NavigationController
   Private Page1 As Page
   Private tts As TTS
End Sub

Private Sub Application_Start (Nav As NavigationController)
   NavControl = Nav
   Page1.Initialize("Page1")
   Page1.Title = "Page 1"
   Page1.RootPanel.Color = Colors.White
   NavControl.ShowPage(Page1)
   tts.Initialize("tts")
End Sub

Sub Page1_Click
   tts.Speak("This is a test", False)
End Sub

Sub TTS_Complete (Text As String)
   Log("Complete")
End Sub
Click on the page to make it speak.
 

Paul Leischow

Member
Licensed User
Tried the above code and it speaks through the speaker on the iPad but not on the iPhone 5C without headphones.
Also just tested on an iPhone 6 and no audio as well through the speaker... only if headphones are plugged in.
(speech is played super fast on all three devices)

Very strange.
 

Paul Leischow

Member
Licensed User
Yaay !!
I can now hear audio from all my devices.

Now why would some devices work fine and others require this fix to force it?
 
Top