1、引用 System.Speech
2、代码示例
static void Main(string[] args) { var synthesizer = new SpeechSynthesizer(); synthesizer.SetOutputToDefaultAudioDevice(); synthesizer.SetOutputToWaveFile(@"D: tsen_1.wav"); synthesizer.Speak("All we need to do is to make sure we keep talking"); Console.WriteLine("Finish"); var content = File.ReadAllText(@"D: tsv.txt", Encoding.UTF8); synthesizer.SelectVoice("Microsoft Huihui Desktop"); synthesizer.SetOutputToWaveFile(@"D: tscn_1.wav"); synthesizer.Speak("你好,早上好,"); synthesizer.SetOutputToWaveFile(@"D: tscn_2.wav"); synthesizer.Speak(content); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }