Click here to Skip to main content
14,392,000 members

Computer Talker with C#

Rate this:
4.05 (28 votes)
Please Sign up or sign in to vote.
4.05 (28 votes)
12 Nov 2014CPOL
Write a program to make your computer talk for you.

Introduction

Write a simple program to make your computer talk for you.

Using the Code

  1. Add a textbox named 'txtWords' to a form.
  2. Add a button named 'btnSpeak' to a form.
  3. Add a reference to System.Speech.
  4. In the form's code-behind, add:
    using System.Windows.Forms;
    using System.Speech.Synthesis;
    
    namespace Sample
    {
     public partial Class Form1: Form
     {
      public SpeechSynthesizer _synthesizer;
      private void btnSpeak_Click(object sender, EventArgs e)
      {
       _synthesizer = new SpeechSynthesizer();
       var words = txtWords.Text;
       _synthesizer.Speak(Words);
      }
      public Form1()
      {
       InitializeComponent();
      }
     }
    }
  5. Run. Text entered into the textbox will be spoken by the computer.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

The Operator
Oproot Research
United States United States
+


Oproot Research
Research, Development
Science Experiments
Photography, Reading

Comments and Discussions

 
GeneralMy vote of 5 Pin
WeaselWes15-Nov-14 6:16
MemberWeaselWes15-Nov-14 6:16 
QuestionShort, Sweet and to the Point Pin
StevieLee14-Nov-14 5:12
MemberStevieLee14-Nov-14 5:12 
AnswerRe: Short, Sweet and to the Point Pin
The Operator14-Nov-14 6:36
MemberThe Operator14-Nov-14 6:36 
AnswerRe: Short, Sweet and to the Point Pin
0x01AA15-Nov-14 1:38
professional0x01AA15-Nov-14 1:38 
QuestionWhy the class level SpeechSynthesizer variable? Pin
spencepk13-Nov-14 10:53
Memberspencepk13-Nov-14 10:53 
AnswerRe: Why the class level SpeechSynthesizer variable? Pin
The Operator13-Nov-14 12:12
MemberThe Operator13-Nov-14 12:12 
GeneralMy vote of 2 Pin
Tammam Koujan12-Nov-14 22:32
professionalTammam Koujan12-Nov-14 22:32 
GeneralRe: My vote of 2 Pin
aeastham13-Nov-14 3:23
Memberaeastham13-Nov-14 3:23 
GeneralRe: My vote of 2 Pin
Tammam Koujan13-Nov-14 4:22
professionalTammam Koujan13-Nov-14 4:22 
GeneralRe: My vote of 2 Pin
The Operator13-Nov-14 8:41
MemberThe Operator13-Nov-14 8:41 
GeneralMy vote of 5 Pin
Humayun Kabir Mamun12-Nov-14 18:39
MemberHumayun Kabir Mamun12-Nov-14 18:39 
GeneralMy vote of 1 Pin
emrea12-Nov-14 9:56
Memberemrea12-Nov-14 9:56 
GeneralMy vote of 5 Pin
Mahsa Hassankashi12-Nov-14 9:38
MemberMahsa Hassankashi12-Nov-14 9:38 
GeneralMy vote of 5 Pin
0x01AA12-Nov-14 9:15
professional0x01AA12-Nov-14 9:15 
GeneralRe: My vote of 5 Pin
The Operator12-Nov-14 9:26
MemberThe Operator12-Nov-14 9:26 
GeneralMy vote of 4 Pin
newton.saber12-Nov-14 8:48
Membernewton.saber12-Nov-14 8:48 
GeneralRe: My vote of 4 Pin
The Operator12-Nov-14 9:27
MemberThe Operator12-Nov-14 9:27 
SuggestionNice tip! Pin
Afzaal Ahmad Zeeshan12-Nov-14 8:46
mvaAfzaal Ahmad Zeeshan12-Nov-14 8:46 
GeneralMy vote of 2 Pin
Mladen Borojevic20-Mar-14 0:02
professionalMladen Borojevic20-Mar-14 0:02 
QuestionJust basic stuff :) Pin
MaskedDev19-Mar-14 7:20
professionalMaskedDev19-Mar-14 7:20 
AnswerRe: Just basic stuff :) Pin
The Operator12-Nov-14 8:36
MemberThe Operator12-Nov-14 8:36 
GeneralMy vote of 2 Pin
Sacha Barber19-Mar-14 3:56
mvaSacha Barber19-Mar-14 3:56 
GeneralRe: My vote of 2 Pin
0x01AA12-Nov-14 7:38
professional0x01AA12-Nov-14 7:38 
QuestionAlso see... Pin
Ravi Bhavnani18-Mar-14 20:21
professionalRavi Bhavnani18-Mar-14 20:21 
AnswerRe: Also see... Pin
The Operator12-Nov-14 8:34
MemberThe Operator12-Nov-14 8:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Tip/Trick
Posted 12 Nov 2014

Tagged as

Stats

31.3K views
500 downloads
23 bookmarked