//Show a list of installed languages for both System and Microsoft static void ShowInstalledLanguage() { using (System.Speech.Synthesis.SpeechSynthesizer synth = new System.Speech.Synthesis.SpeechSynthesizer()) { try { foreach (System.Speech.Synthesis.InstalledVoice voice in synth.GetInstalledVoices()) { System.Speech.Synthesis.VoiceInfo info = voice.VoiceInfo; Console.WriteLine(" Name: " + info.Name); Console.WriteLine(" Culture: " + info.Culture); Console.WriteLine(" Age: " + info.Age); Console.WriteLine(" Gender: " + info.Gender); Console.WriteLine(" ID: " + info.Id); Console.WriteLine(); } } catch (Exception e) { } } using (Microsoft.Speech.Synthesis.SpeechSynthesizer synth = new Microsoft.Speech.Synthesis.SpeechSynthesizer()) { try { foreach (Microsoft.Speech.Synthesis.InstalledVoice voice in synth.GetInstalledVoices()) { Microsoft.Speech.Synthesis.VoiceInfo info = voice.VoiceInfo; Console.WriteLine(" Name: " + info.Name); Console.WriteLine(" Culture: " + info.Culture); Console.WriteLine(" Age: " + info.Age); Console.WriteLine(" Gender: " + info.Gender); Console.WriteLine(" ID: " + info.Id); Console.WriteLine(); } } catch (Exception e) { } } }
private void Form1_Load(object sender, EventArgs e) { strGrammarFile = asr.GetValue("strGrammarFile", "".GetType()).ToString(); foreach (System.Speech.Synthesis.InstalledVoice iv in ss.GetInstalledVoices()) { SSS.VoiceInfo vi = iv.VoiceInfo; string strName = vi.Name + "/" + vi.Age.ToString() + "/" + vi.Gender.ToString() + "/" + vi.Culture.DisplayName; ToolStripItem tsi = setVoiceToolStripMenuItem.DropDownItems.Add(strName); tsi.Tag = vi.Name; tsi.Click += new EventHandler(tsi_Click); } sre.SpeechDetected += new EventHandler <System.Speech.Recognition.SpeechDetectedEventArgs>(sre_SpeechDetected); sre.SpeechRecognized += new EventHandler <System.Speech.Recognition.SpeechRecognizedEventArgs>(sre_SpeechRecognized); ss.SpeakStarted += new EventHandler <System.Speech.Synthesis.SpeakStartedEventArgs>(ss_SpeakStarted); ss.SpeakCompleted += new EventHandler <System.Speech.Synthesis.SpeakCompletedEventArgs>(ss_SpeakCompleted); loadGrammar(); sre.SetInputToDefaultAudioDevice(); sre.RecognizeAsync(SSR.RecognizeMode.Multiple); }
internal InstalledVoice(VoiceSynthesis voiceSynthesizer, VoiceInfo voice) { _voiceSynthesizer = voiceSynthesizer; _voice = voice; _enabled = true; }