2010-04-09 90 views

回答

3

您需要.NET 3.0本:

public void TextToSpeech(string text, string fileName) 
{ 
    using (var stream = File.Create(fileName)) 
    { 
     SpeechSynthesizer speechEngine = new SpeechSynthesizer(); 
     speechEngine.SetOutputToWaveStream(stream); 
     speechEngine.Speak(text); 
     stream.Flush(); 
    } 
}