2013-07-15 46 views
0

我想在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); 
} 

有什麼我應該安裝的,所以它能說荷蘭語嗎?

+1

請參閱此處的備註部分:http://msdn.microsoft.com/en-us/library/ms586875.aspx – TheKingDave

回答

0

實際上,它可以說任何語言安裝在Windows中,支持選定的文化。你確定你已經安裝了能說荷蘭語的聲音嗎(我假設nl-NL文化)?你應該在你的OutputVoiceInfo()方法編寫的控制檯的輸出中找到它。

+0

我還沒有安裝語音,是否有免費的語音,你可以建議? –

+1

@ just8laze荷蘭語版本的Windows默認安裝了荷蘭語。對於免費/預裝版本;這一個是最好的。不過,您可以在開發過程中使用一些免費的聲音。 – Aphelion