Helping TTS Pronounce Words
Again, for the app I’m doing a bit of TTS and part of it is reading the weather. I noticed that a lot of voices, Microsoft Anna for one pronounces something like “25 mph winds” as “Twenty five miles per hour whine-ds” as in “I need to wind my watch or wind up that cord.” But you can put your text into an SSML format and have your app SpeakSSML(string) so you can give it clues on how to read certain bits. You can build paragraphs and sentences, speed up or slow down the reading, or fix pronunciation. Heres a quick sample.
string GenerateWeatherSSML(string words)
{
string windsFix = “<phoneme alphabet=\”x-microsoft-ups\” ph=\”W IH N D S\”>winds</phoneme>”;
StringBuilder finalBuilder = new StringBuilder(“<p><prosody rate=\”-45%\”>”);
finalBuilder.Append(” <s>” + words.Trim().ToLower().Replace(“winds”, windsFix) + “</s> “);
finalBuilder.Append(“</prosody></p> “);
return finalBuilder.ToString();
}
You need to know the MS phoneme alphabet but it’s pretty easy once you do.