I am wondering if there is a way to save text to speech data to an mp3 or Wav file format to be played back at a later time?
SpeechSynthesizer reader = new SpeechSynthesizer();
reader.Rate = (int)-2;
reader.Speak("Hello this is an example expression from the computers TTS engine in C-Sharp);
I am trying to get that saved externally so I can play it back later. What is the best way to do this?
Not my answer, copy paste from How do can I use LAME to encode an wav to an mp3 c#
Easiest way in .Net 4.0:
Use the visual studio Nuget Package manager console:
Code Snip: Send speech to a memory stream, then save as mp3:
Often, if something works on a dev workstation but not on a production server, its a permissions issue. two thoughts: Does Lame create temporary files somewhere? If so the IIS process needs write permissions there. When writing the output file, again the IIS process needs permission to write that.
ConvertWavStreamToMp3File(ref ms, "mytest.mp3");
"mytest.mp3" will probably need to be a full path, usingServer.MapPath()
There are multiple options such as saving to an existing stream. If you want to create a new WAV file, you can use the SetOutputToWaveFile method.