如何更改 System.Speech.Synthesis 上的语言?
how i can change language on System.Speech.Synthesis?
我编写代码并在其上使用 "System.Speech.Synthesis" 库,但它默认只有英语所以我如何将其更改为法语或其他语言??
我的这部分代码:
class Program
{
static void Main(string[] args)
{
using (SpeechSynthesizer synth = new SpeechSynthesizer()) { synth.Speak("Welcome To Calcualtor"); }
}
}
我在网上搜索如何更改它,但我对 c# 了解不多
这是什么我 found
所以我感谢你们的任何帮助或建议,并且已经谢谢了。
您可以select使用您选择的语言的预装语音。
我几乎可以肯定,如果您 select 没有任何声音,系统将使用您 computer/server 的默认语言。
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 !");
}
我编写代码并在其上使用 "System.Speech.Synthesis" 库,但它默认只有英语所以我如何将其更改为法语或其他语言??
我的这部分代码:
class Program
{
static void Main(string[] args)
{
using (SpeechSynthesizer synth = new SpeechSynthesizer()) { synth.Speak("Welcome To Calcualtor"); }
}
}
我在网上搜索如何更改它,但我对 c# 了解不多 这是什么我 found
所以我感谢你们的任何帮助或建议,并且已经谢谢了。
您可以select使用您选择的语言的预装语音。
我几乎可以肯定,如果您 select 没有任何声音,系统将使用您 computer/server 的默认语言。
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 !");
}