Skip to content

Helping TTS Pronounce Words

March 10, 2010

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.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: