public override void Speak(SpeechClient.Speech speech) { try { PromptBuilder p = new PromptBuilder(); p.Culture = tts.Voice.Culture; p.StartVoice(p.Culture); p.StartSentence(); p.StartStyle(new PromptStyle(PromptEmphasis.None)); for (int i = 0; i < speech.Text.Length; i++) { if (speech.Bookmarks == null || speech.Bookmarks.Length < i + 1 || speech.Bookmarks[i]=="") { string s = ""; for (; i < speech.Text.Length; i++) s += speech.Text[i] + " "; p.AppendSsmlMarkup(s); break; } else { p.AppendSsmlMarkup(speech.Text[i]); p.AppendBookmark(speech.Bookmarks[i]); } } p.EndStyle(); p.EndSentence(); p.EndVoice(); currentSpeech = speech; if (speech.Id != "") ids.Add(tts.SpeakAsync(p), speech.Id); else tts.SpeakAsync(p); } catch (Exception e) { Console.WriteLine("WindowsTTS Failed: " + e.Message); } }
public virtual void Speak(SpeechClient.Speech speech) { string fullText = ""; foreach (string s in speech.Text) fullText += s + " "; Console.WriteLine("Speak: " + fullText); }
static void Main(string[] args) { string character = ""; if (args.Length > 0) { character = args[0]; } SpeechClient server = new SpeechClient(character); Console.WriteLine("\nPress a key to close...\n\n"); Console.ReadLine(); server.Dispose(); }
public override void Start(SpeechClient server) { base.Start(server); tts = new SpeechSynthesizer(); bool voiceExists = false; foreach (InstalledVoice v in tts.GetInstalledVoices()) { Console.WriteLine("WindowsTTS: Found '" + v.VoiceInfo.Name + "' voice."); if (v.VoiceInfo.Name == voice) voiceExists = true; } if (voiceExists) tts.SelectVoice(Properties.Settings.Default.Voice); tts.VisemeReached += new EventHandler<VisemeReachedEventArgs>(ProcessViseme); tts.PhonemeReached += new EventHandler<PhonemeReachedEventArgs>(ProcessPhonem); tts.SpeakCompleted += new EventHandler<SpeakCompletedEventArgs>(Ended); tts.SpeakStarted += new EventHandler<SpeakStartedEventArgs>(Started); tts.BookmarkReached += new EventHandler<BookmarkReachedEventArgs>(Bookmark); tts.Rate = Properties.Settings.Default.SpeechRate; Console.WriteLine("Started WindowsTTS speech engine."); }
public virtual void Start(SpeechClient client) { SpeechClient = client; }