Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Speech.Synthesis;
- using System.Text;
- namespace test
- {
- static class HelloWorld
- {
- static void Main()
- {
- Console.OutputEncoding = Encoding.UTF8;
- string text = System.IO.File.ReadAllText("C:\\Users\\HackTheCode\\Documents\\visual studio 2015\\Projects\\HelloCSharp\\test\\text.txt"); // <- add your text file here
- Console.WriteLine(text);
- SpeechSynthesizer synth = new SpeechSynthesizer();
- synth.SelectVoiceByHints(VoiceGender.Male, VoiceAge.Senior);
- synth.SetOutputToDefaultAudioDevice();
- synth.Speak(text);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement