Using SSML with TTS

BobsYourUncle

Member
Licensed User
Longtime User
Hi,

From what I have read, the Android TTS does support simple SSML formatting (Speech Synthesis Markup Language). However, I have tried the following and all the angle brackets are just read out and the formatting is ignored.
B4X:
S = "That is a <emphasis> big </emphasis> car!"
TTS1.Speak(S, True)

Am I doing something wrong, or does the TTS library not support this yet?

Hope someone can help!

P.S. B4A is awesome!
 

BobsYourUncle

Member
Licensed User
Longtime User
OK! That's got it (thanks Erel). If you include the full XML format it works! :sign0060:

B4X:
   t = "<speak version=~1.0~ xmlns=~http://www.w3.org/2001/10/synthesis~" & CRLF
   t = t & "xmlns:xsi=~http://www.w3.org/2001/XMLSchema-instance~" & CRLF
   t = t & "xsi:schemaLocation=~http://www.w3.org/2001/10/synthesis" & CRLF
   t = t & "http://www.w3.org/TR/speech-synthesis/synthesis.xsd~"  & CRLF
   t = t & "xml:lang=~en-US~>"  & CRLF
   t = t & "That Is a <emphasis> big </emphasis> car!" & CRLF
   t = t & "That Is a <emphasis level=~strong~> huge </emphasis>" & CRLF
   t = t & "bank account!" & CRLF
   t = t & "</speak>"
   
   t = t.Replace("~",QUOTE)
   
   TTS1.Speak(t, True)
 
Last edited:
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Just wondering, what if you avoid the headers and just enter:

B4X:
t = "<speak>" & CRLF
t = t & "That Is a <emphasis> big </emphasis> car!" & CRLF
t = t& "</speak>"

Does it work?, I think it should.

EDIT TO ADD: Actually it does work, but I don't hear any emphasis, I tried that on Android 2.x and Android 3.x
 
Last edited:
Upvote 0
Top