in my asp.net project, I code below for a text to speech function. in my page's c# file.
byte[] SpeakText(string text)
{
using (SpeechSynthesizer s = new SpeechSynthesizer())
{
using (MemoryStream ms = new MemoryStream())
{
s.SetOutputToWaveStream(ms);
s.Speak(text);
return ms.GetBuffer();
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text != "")
{
Response.Write(SpeakText(TextBox1.Text));
}
}
but not hear the audio while run it.
How to solve the problem?