Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# System.Speech.Synthesis和Microsoft.Speech.Synthesis有什么区别?_C#_Text To Speech_Speech Synthesis_Microsoft Speech Api_Microsoft Speech Platform - Fatal编程技术网

C# System.Speech.Synthesis和Microsoft.Speech.Synthesis有什么区别?

C# System.Speech.Synthesis和Microsoft.Speech.Synthesis有什么区别?,c#,text-to-speech,speech-synthesis,microsoft-speech-api,microsoft-speech-platform,C#,Text To Speech,Speech Synthesis,Microsoft Speech Api,Microsoft Speech Platform,我目前正在用C语言开发一个小程序,实现文本到语音的转换。但是,我发现有两个名称空间可以使用: 系统、语音、合成 Microsoft.Speech.Synthesis 我在谷歌上搜索差异,找到了一篇关于语音识别的帖子。它并没有真正回答我的问题。我也在他们两个之间切换,没有区别。它适用于代码中的所有语言(如下) 有人能给我解释一下他们两人之间的区别吗?这个区别实际上与链接的答案中所概述的差不多System.SpeechSynthesis使用桌面TTS引擎,而Microsoft.SpeechSyn

我目前正在用C语言开发一个小程序,实现文本到语音的转换。但是,我发现有两个名称空间可以使用:

  • 系统、语音、合成
  • Microsoft.Speech.Synthesis
我在谷歌上搜索差异,找到了一篇关于语音识别的帖子。它并没有真正回答我的问题。我也在他们两个之间切换,没有区别。它适用于代码中的所有语言(如下)


有人能给我解释一下他们两人之间的区别吗?

这个区别实际上与链接的答案中所概述的差不多
System.SpeechSynthesis
使用桌面TTS引擎,而
Microsoft.SpeechSynthesis
使用服务器TTS引擎。从编程角度看,差异相对较小,但从许可角度看,差异很大;服务器TTS引擎是单独许可的


但是,
System.Speech.SpeechSynthesis
Microsoft.SpeechSynthesis
都是不推荐使用的API,新的开发应该基于API。

查看
Microsoft.Speech.Synthesis
的文档,我看到了这样的评论:我们不再定期更新此内容。有关如何支持此产品、服务、技术或API的信息,请查看Microsoft产品生命周期。因此,我只能假设
Microsoft.Speech.Synthesis
被弃用,取而代之的是(大概)较新的
System.Speech.Synthesis
。实际上,它们都被弃用,取而代之的是API。谢谢你的回答。我最终决定使用微软SAPI。我知道它也不推荐使用,但它比Windows.Media.SpeechSynthesis更易于使用,而且还有更多可用的功能。有人能告诉我这些API不推荐使用的页面吗?这一个似乎仍然是最新的-产品生命周期页面提到“语音服务器”,但没有提到“微软语音平台”。是否有任何链接指向Microsoft语音平台(Microsoft.Speech)的持续支持?它是否与特定版本的Windows Server相关联?我将其分解为一个单独的SO问题-
using System;
using System.Speech.Synthesis;
//using Microsoft.Speech.Synthesis;

namespace TTS_TEST
{
class Program
{

    static void Main(string[] args)
    {
          SpeechSynthesizer synth = new SpeechSynthesizer();

          int num;
          string userChoice;

          do
          {
             Console.WriteLine("1 - " + "Microsoft Server Speech Text to Speech Voice (en-US, ZiraPro)");
             Console.WriteLine("2 - " + "Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)");
             Console.WriteLine("3 - " + "Microsoft Server Speech Text to Speech Voice (es-ES, Helena)");
             Console.WriteLine("4 - " + "Microsoft Server Speech Text to Speech Voice (fr-FR, Hortense)");
             Console.WriteLine("5 - " + "Exit");
             Console.Write("Enter the number of your choice: ");     //the user chooses a number
             userChoice = Console.ReadLine();

             if (!Int32.TryParse(userChoice, out num)) continue;

             Console.WriteLine("Choice = " + userChoice);

             if (userChoice == "1")    //Option 1 will use the voice en-US, ZiraPro
             {
                synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-US, ZiraPro)");
             }

             if (userChoice == "2")   //Option 2 will use the voice en-GB, Hazel
             {
                synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)");
             }

             if (userChoice == "3")   //Option 3 will use the voice es-ES, Helena
             {
                synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (es-ES, Helena)");
             }

             if (userChoice == "4")   //Option 4 will use the voice fr-FR, Hortense
             {
                synth.SelectVoice("Microsoft Server Speech Text to Speech Voice (fr-FR, Hortense)");
             }

             if (userChoice == "5")   //Option 5 will exit application
             {
                Environment.Exit(0);
             }

             synth.SetOutputToDefaultAudioDevice();   //set the default audio output

             foreach (InstalledVoice voice in synth.GetInstalledVoices())   //list the installed voices details
             {
                VoiceInfo info = voice.VoiceInfo;

                Console.WriteLine(" Name:          " + info.Name);
                synth.Speak("Name: " + info.Name);
                Console.WriteLine(" Culture:       " + info.Culture);
                synth.Speak("Culture: " + info.Culture);
                Console.WriteLine(" Age:           " + info.Age);
                synth.Speak("Age: " + info.Age);
                Console.WriteLine(" Gender:        " + info.Gender);
                synth.Speak("Gender: " + info.Gender);
                Console.WriteLine(" Description:   " + info.Description);
                Console.WriteLine(" ID:            " + info.Id + "\n");
                synth.Speak("ID: " + info.Id);
             }

             Console.ReadKey();

          }
          while (true);
    }
  }
}