我想在c#中使用tts,並且我的代碼對於英語可以正常工作,但現在我想在荷蘭語中使用它。在荷蘭語中使用SpeechSynthesizer
private void btnSpeak_Click(object sender, EventArgs e)
{
SpeechSynthesizer synthesizer = new SpeechSynthesizer();
foreach (var v in synthesizer.GetInstalledVoices(CultureInfo.CurrentCulture))
{
VoiceInfo info = v.VoiceInfo;
OutputVoiceInfo(info);
}
synthesizer.SelectVoiceByHints(VoiceGender.Male, VoiceAge.Adult, 0, CultureInfo.CurrentCulture);
synthesizer.Volume = 100; // 0...100
synthesizer.Rate = 1; // -10...10
// Synchronous
if(textBox1.Text != null)
synthesizer.SpeakAsync(textBox1.Text);
}
private static void OutputVoiceInfo(VoiceInfo info)
{
Console.WriteLine("Name: {0}, culture: {1}, gender: {2}, age: {3}.\n", info.Name, info.Culture, info.Gender, info.Age);
Console.WriteLine("Description: {0}\n", info.Description);
}
有什麼我應該安裝的,所以它能說荷蘭語嗎?
請參閱此處的備註部分:http://msdn.microsoft.com/en-us/library/ms586875.aspx – TheKingDave