Search code examples
androidtext-to-speechssml

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?


Solution

  • 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.