2016-04-02 4 views
-1

Ich bin ein neues in dieser Welt, ich bin im Problem mit etwas seltsames, ich war Wechsel Windows 7 Text zu Sprache Stimme zu Ivona Brina mein Computer Standard Stimme, aber wenn ich betreibe mein Programm die Stimme ist die gleiche wie erste MS ANNA,So wählen Sie eine Sprachsynthese Stimme in einer Anwendung

UND

es gibt ein weiteres Problem, wenn ich mein Programm Speck dann kommen doppelt,

hier ist meine vollständige Code in C#,

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) 
     { 

     } 
    } 
} 

und hier ist mein ganzes Projekt: ClickLink bitte helfen, Danke ...

Hier die sich beweisen, dass ich IVONA bin 2 Brian Install enter image description here

Antwort

0

Versuchen Sie dieses MSDN Beispiel laufen und sehen, ob Sie kann IVONA Stimme hören.

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

bitte diese sehen, dass ich installieren bin IVONA 2 Brian http://i.stack.imgur.com/MoJ5y.png –

+0

Ok groß, ich den Code aktualisiert haben, versuchen Sie dies und die Ergebnisse gemeinsam nutzen. – Nemo

+0

Nein Herr, es gibt keine Verbesserung dort .... Immer noch der gleiche Sound Ich bin gehört ... –

Verwandte Themen