Advertisement
Dennisaa

Speak a String

Mar 7th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System.Speech.Synthesis;
  2. using System.Threading;
  3.  
  4. namespace ConsoleApplication19 {
  5.     class Program {
  6.         // This is a dumb loop being the basis of the simplest service...
  7.         static void Main(string[] args) {
  8.             var synth = new SpeechSynthesizer();
  9.             var limit = 1000;
  10.             // Configure the audio output.
  11.             synth.SetOutputToDefaultAudioDevice();
  12.             const string stringToSay = "This example demonstrates a basic use of Speech Synthesizer";
  13.  
  14.             do {
  15.                 synth.Speak(stringToSay);
  16.                 limit--;
  17.                 Thread.Sleep(10000);
  18.             } while (limit > 0);
  19.  
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement