Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何更改System.Speech.Synthesis上的语言?_C#_Speech - Fatal编程技术网

C# 如何更改System.Speech.Synthesis上的语言?

C# 如何更改System.Speech.Synthesis上的语言?,c#,speech,C#,Speech,我写代码,我使用它的“System.Speech.Synthesis”库,但它默认只使用英语,所以我怎么能把它改成法语或其他语言 这部分代码: class Program { static void Main(string[] args) { using (SpeechSynthesizer synth = new SpeechSynthesizer()) { synth.Speak("Welcome To Calcualtor"); } } } 我

我写代码,我使用它的“System.Speech.Synthesis”库,但它默认只使用英语,所以我怎么能把它改成法语或其他语言

这部分代码:

class Program
{
    static void Main(string[] args)
    {
       using (SpeechSynthesizer synth = new SpeechSynthesizer()) {  synth.Speak("Welcome To Calcualtor"); }
}

     }
我在网上搜索如何改变它,但我对c#知之甚少 这就是我


所以我感谢你们的帮助和建议,谢谢你们

您可以选择一种预装语音,该语音将使用您选择的语言

我几乎可以肯定,如果您不选择任何语音,您的计算机/服务器将使用默认语言

using (SpeechSynthesizer synthesizer = new SpeechSynthesizer())
{
    synthesizer.SetOutputToDefaultAudioDevice();

    // this
    synthesizer.SelectVoice("ScanSoft Virginie_Dri40_16kHz");

    // or this
    synthesizer.SelectVoiceByHints(VoiceGender.Neutral, VoiceAge.NotSet, 0, CultureInfo.GetCultureInfo("fr-fr"));

    synthesizer.Speak("Bonjour !");
}