I need to turn a text into speech and then save it as wav file.
The following C# code uses the System.Speech namespace in the .Net framework. It is necessary to reference the namespace before using it, because it is not automatically referenced by Visual Studio.
SpeechSynthesizer ss = new SpeechSynthesizer();
ss.Volume = 100;
ss.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult);
ss.SetOutputToWaveFile(@"C:\MyAudioFile.wav");
ss.Speak("Hello World");
I hope this is relevant and helpful.