Exemple #1
0
        public void TtsNormal(string text)
        {
            if (TTSEnabled == false)
            {
                return;
            }

            _prormptBuilder.ClearContent();
            _prormptBuilder.AppendText(text);
            _speechSynthesizer.SpeakAsync(_prormptBuilder);
        }
Exemple #2
0
 private bool ConvertWithMicrosoftSpeech(string FileContent, int rate, CultureInfo ci, string tempPath)
 {
     Console.WriteLine("Converting with: Microsoft Speech");
     try
     {
         using (Microsoft.Speech.Synthesis.SpeechSynthesizer ss = new Microsoft.Speech.Synthesis.SpeechSynthesizer())
         {
             var prompt = new Microsoft.Speech.Synthesis.PromptBuilder(ci);
             prompt.AppendText(FileContent);
             ss.Rate = rate;
             ss.SetOutputToWaveFile(tempPath);
             ss.Speak(prompt);
         }
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(false);
     }
 }
 private bool ConvertWithMicrosoftSpeech(string FileContent, int rate, CultureInfo ci, string tempPath)
 {
     Console.WriteLine("Converting with: Microsoft Speech");
     try
     {
         using (Microsoft.Speech.Synthesis.SpeechSynthesizer ss = new Microsoft.Speech.Synthesis.SpeechSynthesizer())
         {
             var prompt = new Microsoft.Speech.Synthesis.PromptBuilder(ci);
             prompt.AppendText(FileContent);
             ss.Rate = rate;
             ss.SetOutputToWaveFile(tempPath);
             ss.Speak(prompt);
         }
         return true;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return false;
     }
 }