Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.Speech.AudioFormat.SpeechAudioFormatInfo synthFormat =
- new System.Speech.AudioFormat.SpeechAudioFormatInfo(System.Speech.AudioFormat.EncodingFormat.Pcm,
- 8000, 16, 1, 16000, 2, null);
- SpeechSynthesizer synthesizer = new SpeechSynthesizer();
- waveStream = new MemoryStream();
- PromptBuilder pbuilder = new PromptBuilder();
- PromptStyle pStyle = new PromptStyle();
- pStyle.Emphasis = PromptEmphasis.None;
- pStyle.Rate = PromptRate.Fast;
- pStyle.Volume = PromptVolume.ExtraLoud;
- pbuilder.StartStyle(pStyle);
- pbuilder.StartParagraph();
- pbuilder.StartVoice(VoiceGender.Male, VoiceAge.Teen, 2);
- pbuilder.StartSentence();
- pbuilder.AppendText("This is some text.");
- pbuilder.EndSentence();
- pbuilder.EndVoice();
- pbuilder.EndParagraph();
- pbuilder.EndStyle();
- synthesizer.SetOutputToAudioStream(waveStream, synthFormat);
- synthesizer.Speak(pbuilder);
- synthesizer.SetOutputToNull();
- pbuilder.StartStyle(pStyle);
- pbuilder.StartParagraph();
- pbuilder.StartVoice(VoiceGender.Male, VoiceAge.Teen, 2);
- pbuilder.StartSentence();
- pbuilder.AppendText("Checking current weather.");
- pbuilder.EndSentence();
- pbuilder.EndVoice();
- pbuilder.EndParagraph();
- pbuilder.EndStyle();
- ss.SpeakAsync(pbuilder);
- ss.SpeakAsync("Checking current weather");
Add Comment
Please, Sign In to add comment