Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the proper syntax for the phoneme attribute in Android's TTS XML?

My understanding is that this X-SAMPA XML sample, like other samples here and even here & here, is supposed to sound something.

String text = "<speak xml:lang=\"en-US\"> <phoneme alphabet=\"xsampa\" ph=\"faIv\"/>.</speak>";
mTts.speak(text, TextToSpeech.QUEUE_ADD, null); 

However, for some strange reason, it doesn't say anything (total silent).

What am I missing?

To clarify: My TTS sample app is setup OK: If I change that . before that </speak> tag to any word, the Android TTS just says that word fine. My only problem is that I am not able to utilize the <phoneme alphabet=\"xsampa\" ph=\"faIv\"/> in any way.

I understand that a . is supposed to be silent, but then according to the posters of those samples, it's supposed to sound the XSAMPA phonemes in the XML. What am I missing?

like image 339
an00b Avatar asked Aug 29 '11 18:08

an00b


People also ask

What is Android TTS features?

Also known as "speech synthesis", TTS enables your Android device to "speak" text of different languages.

How do I use Google Text to Speech in Android Studio?

java file to add TextToSpeech code. Modify layout XML file res/layout/activity_main. xml add any GUI component if required. Run the application and choose a running android device and install the application on it and verify the results.


2 Answers

The correct syntax for what you are trying to do is exactly as you posted in your question. If your phone is setup to use the default Pico TTS, that is.

Under Settings > Voice input & output > Text-to-speech settings > Default Engine make sure that Pico TTS is selected and try the same code now.

like image 165
ateiob Avatar answered Sep 23 '22 19:09

ateiob


The correct syntax for the phoneme element is documented in the W3C Speech Synthesis Markup Language documentation.

As mentioned in the answer Stack Overflow question 3648239 not all elements are parsed properly.

There is further clarification of the parsing error in this google groups forum post however it would appear that these errors can be ignored.

You may be able to find more information in the TTS-for-android site on google groups by posting your question there.

I have been unable to read the samples as the website is down. I'm not sure if this is a temporary problem ubt I will check back at a later date to see if I can find them.

like image 27
Moog Avatar answered Sep 22 '22 19:09

Moog