Create an ASP.NET text-to-speech application

I want to get an idea of ​​creating an application that converts text to speech in ASP.NET. According to my initial research, it seems that:

  • MS SAPI requires that the client download the ActiveX component and can support a large amount of text to be converted. Our customers are reluctant to install any components in their systems, so this approach may or may not fly.

  • I understand with .NET 3.0, we have the System.Speech.Synthesis namespace. Is there a conversion on the server? If so, how can I serve it for a client?

Our requirements - the ability to convert a large volume of text, must be scalable and reliable. What technology is “off-the-shelf” capable of serving a large number of requests in a short amount of time.

Any thoughts are appreciated.

+3
source share
5 answers

By default, ASP.Net applications do not start with sufficient permissions to access speech synthesis, and an attempt to run Larsenal code will fail with a security error.

, WCF, , Windows. ASP.Net . , , .

, ? .

, 11-12-09, :

System.Speech , wav , , . -, :

1) Page.aspx 'embed', Windows Media. - "PlayText.aspx? Textid = whatever".
2) PlayText.aspx ( WCF) , .
3) Speechreader MemoryStream SpeechSynthesiser.SetOutputToWaveStream, . - Response.Write() - ed .

SpeechReader:

    byte[] ITextReader.SpeakText(string text)
    {
        using (SpeechSynthesizer s = new SpeechSynthesizer())
        {
            using (MemoryStream ms = new MemoryStream())
            {
                s.SetOutputToWaveStream(ms);
                s.Speak(text);
                return ms.GetBuffer();
            }
        }
    }

, ​​ . , . , , - :

<byte>23</byte>
<byte>42</byte>
<byte>117</byte>
...
+5

SpeechSynthesizer WAV . . , .

CodeProject .NET Speech Synthesis.

, LOT ... System.Speech, :

using System;
using System.Speech.Synthesis;

namespace SpeakToMe
{
    class Program
    {
        static void Main(string[] args)
        {
            SpeechSynthesizer synth = new SpeechSynthesizer();
            synth.SetOutputToWaveFile("c:\\test.wav");
            synth.Speak("Hello, world.");
            synth.SetOutputToDefaultAudioDevice();

            Console.ReadLine();
        }
    }
}

44 700 (238 ) ...

  • 55
  • WAV 626 .
0

, codeBehind javascript, " ":

CodeBehind:

Page.ClientScript.RegisterStartupScript(
GetType(), 
"anythingHere", 
"nameOfFunction();", 
true);

JavaScript:

<script>
  function nameOfFunction()
    {//start
       var msg = new SpeechSynthesisUtterance('READ ME!');
       window.speechSynthesis.speak(msg);
    }//end
</script>
0

Source: https://habr.com/ru/post/1680219/


All Articles