2016-04-02 33 views
-1

私はこの世界では新しいですが、私はいくつか変わったことで問題に陥っています。私はWindows 7 Text To Speech音声をIvona Brinaに送ります。私は声が、アプリケーションで音声合成音声を選択する方法

私はそれは、二重に来る私のプログラムに斑点たときに、別の問題があり、ここで

は、C#での私の完全なコードで、

最初のMS ANNAと同じである私のプログラムを実行します
using System; 
using System.Collections.Generic; 
using System.ComponentModel; 
using System.Data; 
using System.Drawing; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Forms; 
using System.Speech.Synthesis; 
using System.Speech.Recognition; 
using System.Threading; 
using System.Diagnostics; 
using System.Globalization; 
using System.IO; 


namespace VoiceRs 
{ 
    public partial class Form1 : Form 
    { 
     public Form1() 
     { 
      InitializeComponent(); 
      this.button1.Click += new EventHandler(button1_Click); 
      this.button2.Click += new EventHandler(button2_Click); 
      this.button3.Click += new EventHandler(button3_Click); 

      foreach (InstalledVoice voice in sSynth.GetInstalledVoices()) 
      { 
       Console.WriteLine(voice.VoiceInfo.Name); 
      } 
     } 
     SpeechSynthesizer sSynth = new SpeechSynthesizer(); 
     PromptBuilder pBuilder = new PromptBuilder(); 
     SpeechRecognitionEngine sRecognize = new SpeechRecognitionEngine(); 

     private void Form1_Load(object sender, EventArgs e) 
     { 

     } 

     private void button1_Click(object sender, EventArgs e) 
     { 
      pBuilder.ClearContent(); 
      pBuilder.AppendText(textBox1.Text); 
      sSynth.SelectVoice("IVONA 2 Brian"); 
      sSynth.Speak(pBuilder); 
     } 

     private void button2_Click(object sender, EventArgs e) 
     { 
      button2.Enabled = false; 
      button3.Enabled = true; 
      Choices sList = new Choices(); 
      sList.Add(new string[] { "hello", "test", "it works", "how", "are", "you", "today", "i", "am", "fine", "exit", "close", "quit", "so", "hello how are you" }); 
      Grammar gr = new Grammar(new GrammarBuilder(sList)); 
      try 
      { 
       sRecognize.RequestRecognizerUpdate(); 
       sRecognize.LoadGrammar(gr); 
       sRecognize.SpeechRecognized += sRecognize_SpeechRecognized; 
       sRecognize.SetInputToDefaultAudioDevice(); 
       sRecognize.RecognizeAsync(RecognizeMode.Multiple); 
       sRecognize.Recognize(); 
      } 

      catch 
      { 
       return; 
      } 
     } 

     private void button3_Click(object sender, EventArgs e) 
     { 
      sRecognize.RecognizeAsyncStop(); 
      button2.Enabled = true; 
      button3.Enabled = false; 
     } 

     private void sRecognize_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) 
     { 


      if (e.Result.Text == "exit") 
      { 
       Application.Exit(); 
      } 
      else 
      { 
       textBox1.Text = textBox1.Text + " " + e.Result.Text.ToString(); 
      } 

     } 

     private void textBox1_TextChanged(object sender, EventArgs e) 
     { 

     } 
    } 
} 

と、ここは私の完全なプロジェクトです:ClickLink は助けてください、ありがとう...ここ

私はIVONA 2ブライアンをインストールしていたことを証明され enter image description here

答えて

0

このMSDNの例を実行してみてください、あなたがあるかどうかを確認IVONAの声を聞くことができます。

private void button1_Click(object sender, EventArgs e) 
{ 
    using (SpeechSynthesizer synth = new SpeechSynthesizer()) 
    { 
     // Configure the audio output 
     synth.SetOutputToDefaultAudioDevice(); 

     // Build a prompt 
     PromptBuilder builder = new PromptBuilder(); 
     builder.AppendText("That is a big pizza!"); 

     foreach (InstalledVoice voice in synth.GetInstalledVoices()) 
     { 
      VoiceInfo info = voice.VoiceInfo; 

      // Select voice 
      synth.SelectVoice(info.Name); 

      // Speak the prompt 
      synth.Speak(builder); 
     } 
    } 
} 
+0

私は[OK]を偉大なIVONA 2ブライアンhttp://i.stack.imgur.com/MoJ5y.png –

+0

をインストールだと、これを参照してください、私は、コードを更新した、これを試してみて、その結果を共有しています。 – Nemo

+0

いいえ、そこには改善がありません....まだ同じサウンド私は聞いている...... –