В чем разница между System.Speech.Synthesis и Microsoft.Speech.Synthesis? - PullRequest
0 голосов
/ 06 февраля 2019

В настоящее время я разрабатываю небольшую программу на C #, реализующую Text-To-Speech.Однако я обнаружил, что можно использовать два пространства имен:

  • System.Speech.Synthesis
  • Microsoft.Speech.Synthesis

Я гуглил различия и нашел этот пост, посвященный распознаванию речи.Это действительно не отвечает на мой вопрос.Я также переключился между ними и не было никакой разницы.Он работал со всеми языками в коде (ниже).

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

Может ли кто-нибудь объяснить мне различия между ними двумя?

1 Ответ

0 голосов
/ 08 апреля 2019

Разница действительно в значительной степени описана в связанном ответе;System.Speech.SpeechSynthesis использует настольные движки TTS, а Microsoft.Speech.SpeechSynthesis использует серверные движки TTS.Различия относительно незначительны с точки зрения программирования, но значительно отличаются с точки зрения лицензирования;серверные модули TTS лицензируются отдельно.

Однако и System.Speech.SpeechSynthesis, и Microsoft.Speech.SpeechSynthesis являются устаревшими API, и новая разработка должна основываться на Windows.Media.SpeechSynthesis API.

...