This question is essentially about the suitability of Microsoft\'s Speech API (SAPI) for server workloads and whether it can be used reliably inside of w3wp for
This question is a bit old now, but this is what I'm doing and it's been working great so far:
public Task Speak(string text)
{
return Task.Factory.StartNew(() =>
{
using (var synthesizer = new SpeechSynthesizer())
{
var ms = new MemoryStream();
synthesizer.SetOutputToWaveStream(ms);
synthesizer.Speak(text);
ms.Position = 0;
return new FileStreamResult(ms, "audio/wav");
}
});
}
might help someone...