【发布时间】:2018-05-08 07:46:50
【问题描述】:
我有一些英语文化以外的文本。 例如:泰米尔文化。
如果我不提及文化,将采用默认英语。
如何将文字转成语音(英文除外)?
代码sn-p:
英语语言:
public static void ConvertTextToVoice()
{
SpeechSynthesizer speech = new SpeechSynthesizer();
speech.Volume = 100;
speech.Rate = 0;
speech.Speak("Welcome to india");
}
对于其他语言:
public static void ConvertTextToVoice()
{
SpeechSynthesizer speech = new SpeechSynthesizer();
speech.Volume = 100;
speech.Rate = 0;
//Tamil Text
string text = "பெயர்ச் சொல் சகோதரன் பிரதி பெயர்கள் வினைச் சொல் வினை அடை";
PromptBuilder builder = new PromptBuilder(new System.Globalization.CultureInfo("ta-IN"));
builder.AppendText(text);
speech.SpeakAsync(builder);
}
【问题讨论】:
-
那么,如果我正确理解了您的问题 - 您要求基于输入的字符串进行语言检测?
-
是的。需要根据语言改变文化
-
@Pandi:参考这个问题stackoverflow.com/q/1192768/5395773
-
@venkat:此链接将用于检测语言。但我的要求是需要将该文本转换为语音。
标签: c# text-to-speech culture speech-synthesis