/// <summary> /// Get volume to speak text /// </summary> /// <param name="volume"></param> /// <returns></returns> private static string GetVolume(SpeakerVolume volume) { string returnValue = string.Empty; switch (volume) { case SpeakerVolume.ExtraSoft: returnValue = "x-soft"; break; case SpeakerVolume.Soft: returnValue = "soft"; break; case SpeakerVolume.Medium: returnValue = "medium"; break; case SpeakerVolume.Loud: returnValue = "loud"; break; case SpeakerVolume.ExtraLoud: returnValue = "x-loud"; break; case SpeakerVolume.Default: returnValue = "default"; break; } return(returnValue); }
public static string GetText(string stringToSpeak, Pitch pitch, Speed speed, SpeakerVolume volume, string language) { string returnValue; returnValue = "<speak version=\"1.0\" "; returnValue += "xmlns=\"http://www.w3.org/2001/10/synthesis\" xml:lang=\"" + language + "\" >"; returnValue += "<prosody rate= \"" + GetRate(speed) + "\""; returnValue += " volume= \"" + GetVolume(volume) + "\""; returnValue += " pitch=\"" + GetPitch(pitch) + "\" >"; returnValue += stringToSpeak; returnValue += "</prosody>"; returnValue += "</speak>"; return(returnValue); }