SpeakComputers.com online store
Electronics Software Computers Handhelds Laptops and Tablets Mobile Phones Digital Cameras Camcorders Games Music Books Sport Mens and Womens Watches Power Tools Household appliances
Software Downloads 2012 Software Mac Software Security Student Editions Windows 7 Office 2010

Text to Speech, System.Speech.

The Microsoft .Net Framewok version 3.0 introduces the long awaited System.Speech assembly. With the System.Speech assembly you can create speech enabled Windows applications including, Text to Speech and Speech recognition.

Namespace: System.Speech
Assembly: Systems.Speech.dll

using System.Speech;
Calling: System.Speech
Requirements: .Net FrameWork 3.0

Download the complete project here. Requirements, VisualStudio 2005 and .Net 3.0

Creating Speech enabled Windows applications could not be easier. To prove to you just how easy it is, lets create a simple yet powerful Text to Speech application. We are going to create a Single document interface, add a menu, context menu, status bar and use a richtextbox control for our textarea.

To start, open Visual Studio 2005, create a new Windows c# project. Add a reference to the System.Speech assembly. On Form1 or mainForm add a statusBar, context menu, MenuStrip and a richTextBox which will be docked to fill the form.

Declare your SpeechSynthesizer speakRBox.
System.Speech.Synthesis.SpeechSynthesizer speakRBox = new System.Speech.Synthesis.SpeechSynthesizer();

On the MenuStrip, create Speak, Pause and Stop menu items. Create the Click events for the menu items just created. Under the Speak event add the following code.

if (speakRBox.State == System.Speech.Synthesis.SynthesizerState.Ready) { speakRBox.SpeakProgress += new EventHandler(speakRBox_SpeakProgress); speakRBox.SpeakCompleted += new EventHandler(speakRBox_SpeakCompleted); speakRBox.SelectVoice(toolStripComboBox1.SelectedItem.ToString()); speakRBox.SpeakAsync(this.richTextBox1.Text); return; } if (speakRBox.State == System.Speech.Synthesis.SynthesizerState.Paused) { speakRBox.Resume(); }

Under the Pause event, add the following code.

if (speakRBox.State == System.Speech.Synthesis.SynthesizerState.Speaking) { speakRBox.Pause(); this.toolStripStatusLabel1.Text = "Paused"; return; } if (speakRBox.State == System.Speech.Synthesis.SynthesizerState.Paused) { speakRBox.Resume(); } 

Under the Stop event.

if (speakRBox.State == System.Speech.Synthesis.SynthesizerState.Speaking) { speakRBox.SpeakAsyncCancelAll(); } 

Additional things to do.

You can add the feature of speaking the text to a wav file for later play back. To do this, add a menu item and create a click event. Under the click event add the following code.

speakRBox.SetOutputToWaveFile(@"c:\1.wav");
speakRBox.SpeakAsync("Hello World");
Home About Privacy Policy Resouces Products Map

Copy Right 2006 SpeakComputers.com - All Rights Reserved.
Learn Spanish
Learn Spanish for free with our online and free tutorials with audio. See our grammar sections, verb sections and drills, massive vocabulary sections with audio, our Spanish verb conjugator and more.
Free Text to Speech Software
Get software that makes your computer read text aloud.
Text to Speech software that supports natural sounding TTS voices.
Convert text to MP3 files
Listen to webpages aloud or convert them to sound files