Search code examples
androidxmltext-to-speech

XSAMPA phonetic emphasis specification in Android


Thanks to this post (referenced in this question) regarding the specification of phonetics, I'm able to use XSAMPA in the TTS engine. However, how am I to specify the Primary Stress character (double-quote, i.e. ") in the XML?

Sending XML like the following will end up not speaking anything, presumably because of the second (premature) occurrence of the double-quote character when specifying the ph= value:

"<speak xml:lang=\"en-US\"> <phoneme alphabet=\"xsampa\" ph=\"\"[email protected] \"wVn\"/>.</speak>"

Am I to just forget about the primary stress character because of the way the XML is specified, or is there a workaround?


Solution

  • Why don't you try &quot; as specified here, instead of an intermediate \"?

    So you would have:

    "<speak xml:lang=\"en-US\"> <phoneme alphabet=\"xsampa\" ph=\"&quot;[email protected] &quot;wVn\"/>.</speak>"