Speaking Clock (TTS) and C#
You can easily create a speaking clock with a few lines of code using C# and .Net.
Create a new Windows Forms Project. In your new Project, add a reference to the
System.Speech dll. (.Net 3.0 required).
In the code view of the main form, create a new Speech Synthesizer object as below.
System.Speech.Synthesis.SpeechSynthesizer SpeakingClock = new System.Speech.Synthesis.SpeechSynthesizer();
Add a Timer control to the main form and in the timer tick event add the following.
this.label1.Text = DateTime.Now.ToString();
DateTime dt = DateTime.Now;
if (dt.Minute == 17)
{
SpeakingClock.Speak(dt.ToString ());
}
On the forms load event, start the timer.
this.timer1.Start();
|