Creating a ASP.NET application converting text to speech

后端 未结 5 850
野趣味
野趣味 2020-12-02 00:57

I seek some insight in creating an application that converts text to speech in ASP.NET. From my initial research, it appears that:

  1. MS SAPI requires the clie

5条回答
  •  悲哀的现实
    2020-12-02 01:22

    With the SpeechSynthesizer, you can output to a WAV file. You could then have a secondary process compress or convert to another format if needed. All this could be done on the server and then sent up through the browser.

    This CodeProject article is a good introduction to .NET Speech Synthesis.

    If you want to see how it performs with a LOT of text.... Add a reference to System.Speech and then use the following as a starting point:

    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();
            }
        }
    }
    

    A quick test on a file of 44,700 words (238KB) on my relatively fast machine...

    • Completed in 55 seconds
    • Generated a 626 MB WAV file

提交回复
热议问题