I have the following code snippet in an ASP.NET app (non Silverlight)
string sText = \"Test text\";
SpeechSynthesizer ss = new SpeechSynthesizer();
MemoryStre
Here's the main bit to an IHttpHandler that does what you want. Plug the handler URL into a bgsound tag or pipe it to whatever to play in-browser, and add a querystring check for a "downloadFile" var or something to conditionally add a Content-Disposition: attachment; filename=whatever.wav header if you want to download. No intermediate file is necessary (though there is weirdness with the SetOutputToWaveStream thing failing if it's not run on another thread).
public void ProcessRequest(HttpContext context)
{
MemoryStream ms = new MemoryStream();
context.Response.ContentType = "application/wav";
Thread t = new Thread(() =>
{
SpeechSynthesizer ss = new SpeechSynthesizer();
ss.SetOutputToWaveStream(ms);
ss.Speak("hi mom");
});
t.Start();
t.Join();
ms.Position = 0;
ms.WriteTo(context.Response.OutputStream);
context.Response.End();
}